require 'sinatra'
require 'sinatra/reloader' if development?
require 'haml'

require_relative 'lib/config'
require_relative 'lib/db-config'
require_relative 'lib/links'

class Blog < Sinatra::Application 

	get "#{$app_root}/" do
		posts = Post.get_first_10
		haml :blog_layout, :locals => { :posts => posts }
	end

	get "#{$app_root}/n/:id" do
		post = Post.get(params[:id])
		haml :post_layout, :locals => { :post => post, :show_comments => true }
	end
	
	get "#{$app_root}/:title" do
		post = Post.first( :urltext => params[:title])
		haml :post_layout, :locals => { :post => post, :show_comments => true }
	end
end


require 'sinatra'
require 'haml'

require_relative 'lib/config'
require_relative 'lib/db-config'
require_relative 'lib/links'

class Blog < Sinatra::Application 

	get "#{$app_root}/" do
		posts = Post.get_first_10
		haml :blog_layout, :locals => { :posts => posts }
	end

	get "#{$app_root}/n/:id" do
		post = Post.get(params[:id])
		haml :post_layout, :locals => { :post => post, :show_comments => true }
	end
	
	get "#{$app_root}/:title" do
		post = Post.first( :urltext => params[:title])
		haml :post_layout, :locals => { :post => post, :show_comments => true }
	end
end


Revert "Use sinatra/reloader in development mode" (doesn't seem to work easily. Just drop it for now)
Revert "Use sinatra/reloader in development mode"
(doesn't seem to work easily. Just drop it for now)

This reverts commit afaeb0eb5180d36c7464d04641582932d8ad0c91.
