lib/mado/app.rb in mado-0.0.4 vs lib/mado/app.rb in mado-0.1.0
- old
+ new
@@ -11,18 +11,34 @@
configure :development do
require "sinatra/reloader"
register Sinatra::Reloader
end
+ helpers do
+ def markdown_dir
+ @markdown_dir ||= File.dirname(settings.markdown_path)
+ end
+ end
+
get '/' do
slim :index
end
get "/css/application.css" do
sass :application
end
get "/js/application.js" do
coffee :application
+ end
+
+ get "/*" do
+ path = File.expand_path(params[:splat][0], markdown_dir)
+
+ if File.exist?(path)
+ send_file path, disposition: "inline"
+ else
+ not_found
+ end
end
end
end