forked from gglin/student-sinatra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.rb
executable file
·47 lines (37 loc) · 948 Bytes
/
app.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
require 'sinatra/base'
require 'sqlite3'
require_relative 'lib/concerns/persistable'
require_relative 'lib/concerns/findable'
require_relative 'lib/models/student'
# Why is it a good idea to wrap our App class in a module?
module StudentSite
class App < Sinatra::Base
def initialize
super
@artists = ["Frank Sinatra", "Bing Crosby", "Bob\n\n\n\n", 1, 2, "dslajkffoiejfijasdlfl"]
end
def set_random_numbers(arg)
@random_numbers = arg
end
get '/' do
"hello world!"
end
get '/hello-world' do
set_random_numbers((1..20).to_a)
p @random_numbers
erb :hello
end
get '/artists' do
erb :artists
end
get '/students' do
@students = Student.all
erb :'students/students'
end
get '/students/:url' do
# @students = Student.all
@student = Student.find_by_url(params[:url])
erb :'students/student_profile'
end
end
end