require 'gollum/app'
require 'sinatra/flash'
require "sqlite3"
require 'tonton_web'

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/readme' do
		erb request.path_info.to_sym, layout_engine: :erb, layout: :chapa_sigmoide
	end

	get '/chapa-sigmoide/:name' do
		markdown request.path_info.to_sym, layout_engine: :erb, layout: :chapa_sigmoide
	end
end