forked from TonTon-UFPA-Comput/site
30 lines
No EOL
817 B
Ruby
30 lines
No EOL
817 B
Ruby
require 'gollum/app'
|
|
require 'sinatra/flash'
|
|
require "sqlite3"
|
|
require 'tonton_web'
|
|
# TODO: better, simpler route matching
|
|
class TonTonWeb::App < Sinatra::Base
|
|
set :host_authorization, { permitted_hosts: ['localhost', 'mytonton.com.br'] }
|
|
|
|
set :sessions, true
|
|
|
|
get '/' do
|
|
redirect "/home"
|
|
end
|
|
|
|
get '/home' do
|
|
markdown File.read("readme.md"), layout_engine: :erb, layout: true
|
|
end
|
|
|
|
get '/:name' do
|
|
markdown request.path_info.to_sym, layout_engine: :erb, layout: true
|
|
end
|
|
|
|
get '/chapa-sigmoide/:name' do
|
|
if request.path_info.end_with? '.markdown'
|
|
markdown request.path_info.sub('.markdown', '').to_sym, layout_engine: :erb, layout: :chapa_sigmoide
|
|
elsif request.path_info.end_with? '.erb'
|
|
erb request.path_info.sub('.erb', '').to_sym, layout_engine: :erb, layout: :chapa_sigmoide
|
|
end
|
|
end
|
|
end |