From 6faf41630a5bb8eb23f3a2800ab01a8121fa1b09 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Tue, 8 Mar 2016 17:23:40 -0500 Subject: rename handlers --- src/guff/handlers/blog-handler.cr | 104 -------------------------------------- 1 file changed, 104 deletions(-) delete mode 100644 src/guff/handlers/blog-handler.cr (limited to 'src/guff/handlers/blog-handler.cr') diff --git a/src/guff/handlers/blog-handler.cr b/src/guff/handlers/blog-handler.cr deleted file mode 100644 index c95938c..0000000 --- a/src/guff/handlers/blog-handler.cr +++ /dev/null @@ -1,104 +0,0 @@ -require "../handler" - -class Guff::Handlers::BlogHandler < Guff::Handler - ROUTES = [{ - list: false, - blog: true, - re: %r{ - ^/ - - # match YYYY/MM/DD/SLUG.html - (?\d{4}) - / - (?\d{2}) - / - (?\d{2}) - / - (?[a-z0-9._-]+) - \.html - - $ - }x, - }, { - list: true, - blog: true, - re: %r{ - ^/ - - # match YYYY/MM/DD - (?\d{4}) - / - (?\d{2}) - / - (?\d{2}) - /? - - $ - }x, - }, { - list: true, - blog: true, - re: %r{ - ^/ - - # match YYYY/MM - (?\d{4}) - / - (?\d{2}) - /? - - $ - }x, - }, { - list: true, - blog: true, - re: %r{ - ^/ - - # match YYYY - (?\d{4}) - /? - - $ - }x, - }, { - list: false, - blog: false, - re: %r{ - ^/ - - # match slug - (?[a-z0-9._-]+) - \.html - - $ - }x, - }, { - list: true, - blog: true, - re: %r{ - # match index - ^/$ - }x, - }] - - def call(context : HTTP::Server::Context) - path = context.request.path || "" - - call_next(context) unless ROUTES.reduce(false) do |matched, route| - unless matched - if md = (route[:re] as Regex).match(path) - # matched route - matched = true - - context.response.puts "blog: route = %s, md = %s" % [ - route.to_s, - md.to_s - ] - end - end - - matched - end - end -end -- cgit v1.2.3