-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.ru
More file actions
73 lines (64 loc) · 1.36 KB
/
config.ru
File metadata and controls
73 lines (64 loc) · 1.36 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
require 'koda'
require 'dalli'
set :views, "templates"
set :public_folder, "public"
# Flush the cache on app start up
client = Dalli::Client.new
client.flush()
#
# Add or modify these routes at your own discretion
#
# Usage help
#
# get '[url_to_match]' do
# show [:view_name]
# end
#
# get '[url_to_match]/:name/:another' do
# # get parameters
# name = params[:name]
# another = params[:another]
#
# # and return json
# JSONP {'another'=>another, 'name' => name}
# end
#
# post '[url_to_match]' do
# # get the raw data
# data = request.env["rack.input"].read
# # do something with data
# end
#
# put '[url_to_match]' do
# # or get it as a hash
# data_as_hash = JSON.parse request.env["rack.input"].read
# # do something with data
# end
#
# delete '[url_to_match]/:name' do
# # get parameters
# name = params[:name]
# end
#
#
get '/' do
# you can set a variable to access from your view.
# example...
# @current_page = filtered('pages', 'home')
# OR
# @current_page = document('pages', 'home')
@current_page = 'home_page'
@title = "Koda Placeholder Page"
show :generic
end
get '/post/:alias?' do
@current_page = params[:alias]
@title = "Welcome to the BlogStarterKit"
show :post
end
get '/:page?' do
@current_page = params[:page]
@title = "Welcome to the BlogStarterKit"
show :generic
end
run Sinatra::Application