aboutsummaryrefslogtreecommitdiff
path: root/src/guff.cr
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2016-03-05 19:03:32 -0500
committerPaul Duncan <pabs@pablotron.org>2016-03-05 19:03:32 -0500
commitefe09d414a7a8e71974dde57833ebbe97e997146 (patch)
tree59b80f3c5a92e8d3870a023c134011f4327e223c /src/guff.cr
parentdf8dbe48e73581599f73c365e173fb017f0919c3 (diff)
downloadold-guff-efe09d414a7a8e71974dde57833ebbe97e997146.tar.bz2
old-guff-efe09d414a7a8e71974dde57833ebbe97e997146.zip
refactor blog-handler
Diffstat (limited to 'src/guff.cr')
-rw-r--r--src/guff.cr60
1 files changed, 0 insertions, 60 deletions
diff --git a/src/guff.cr b/src/guff.cr
index e62ff1f..2bec70d 100644
--- a/src/guff.cr
+++ b/src/guff.cr
@@ -2,66 +2,6 @@ require "http/server"
require "./guff/*"
module Guff
- class BlogHandler < Handler
- MATCHES = [%r{
- ^/
-
- # match YYYY/MM/DD/SLUG.html
- (?<year>\d{4})
- /
- (?<month>\d{2})
- /
- (?<day>\d{2})
- /
- (?<slug>[a-z0-9._-]+)
- \.html
-
- $
- }x, %r{
- ^/
-
- # match YYYY/MM/DD
- (?<year>\d{4})
- /
- (?<month>\d{2})
- /
- (?<day>\d{2})
- /?
-
- $
- }x, %r{
- ^/
-
- # match YYYY/MM
- (?<year>\d{4})
- /
- (?<month>\d{2})
- /?
-
- $
- }x, %r{
- ^/
-
- # match YYYY
- (?<year>\d{4})
- /?
-
- $
- }x, %r{
- # match index
- ^/$
- }x]
-
- def call(context : HTTP::Server::Context)
- path = context.request.path || ""
- if md = MATCHES.reduce(nil) { |r, m| r || m.match(path) }
- context.response.puts "blog match: %s" % [md.to_s]
- else
- call_next(context)
- end
- end
- end
-
class SlugHandler < Handler
MOCK_SLUGS = {
"foo": "test slug foo",