aboutsummaryrefslogtreecommitdiff
path: root/src/guff
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2016-03-05 20:26:23 -0500
committerPaul Duncan <pabs@pablotron.org>2016-03-05 20:26:23 -0500
commit0c003fc2985c5ce0a2d04026d63ab7265ce9af94 (patch)
tree1fbb7cf4b822d1db2d5a439a647d721fe158cc3d /src/guff
parent61e112e62a3a7e96704b2c5d82f410cd94151ee0 (diff)
downloadold-guff-0c003fc2985c5ce0a2d04026d63ab7265ce9af94.tar.bz2
old-guff-0c003fc2985c5ce0a2d04026d63ab7265ce9af94.zip
add minimal not found handler
Diffstat (limited to 'src/guff')
-rw-r--r--src/guff/not-found-handler.cr10
-rw-r--r--src/guff/server.cr5
2 files changed, 12 insertions, 3 deletions
diff --git a/src/guff/not-found-handler.cr b/src/guff/not-found-handler.cr
new file mode 100644
index 0000000..b15b1dc
--- /dev/null
+++ b/src/guff/not-found-handler.cr
@@ -0,0 +1,10 @@
+require "./handler"
+
+module Guff
+ class NotFoundHandler < Handler
+ def call(context : HTTP::Server::Context)
+ context.response.status_code = 404
+ context.response.puts "not found"
+ end
+ end
+end
diff --git a/src/guff/server.cr b/src/guff/server.cr
index 794045a..bc4494c 100644
--- a/src/guff/server.cr
+++ b/src/guff/server.cr
@@ -15,9 +15,7 @@ module Guff
config["host"],
config["port"].to_i,
get_handlers(model, config)
- ) do |context|
- context.response.puts "asdf"
- end
+ )
end
def run
@@ -36,6 +34,7 @@ module Guff
BlogHandler.new(model, config),
SlugHandler.new(model, config),
HTTP::StaticFileHandler.new(config["public"]),
+ NotFoundHandler.new(model, config),
]
end
end