aboutsummaryrefslogtreecommitdiff
path: root/interfaces/http/web/web.rb
diff options
context:
space:
mode:
Diffstat (limited to 'interfaces/http/web/web.rb')
-rw-r--r--interfaces/http/web/web.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/interfaces/http/web/web.rb b/interfaces/http/web/web.rb
index ca04ecc..16492c2 100644
--- a/interfaces/http/web/web.rb
+++ b/interfaces/http/web/web.rb
@@ -1,6 +1,21 @@
class WebInterface < Sinatra::Base
get '/' do
+ @title = $config.title
@posts = Post.all
erb :index
end
+
+ get '/:year/:month/:day/:slug' do
+ @posts = Post.where(slug: params['slug'])
+
+ if @posts.empty? then
+ status 404
+ @title = '404 Not Found'
+ erb :not_found
+ else
+ @post = @posts[0]
+ @title = @post.title
+ erb :post
+ end
+ end
end