aboutsummaryrefslogtreecommitdiff
path: root/src/guff/handlers.cr
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2016-03-06 17:29:50 -0500
committerPaul Duncan <pabs@pablotron.org>2016-03-06 17:29:50 -0500
commitb1395163fa45ed788af4d2d003c1dd49846d86ee (patch)
tree39ba885f3a7d51836f13c59e1f6f6d01dc756071 /src/guff/handlers.cr
parent5a57a15f5e154b2e2dc312b1e92600449c6ca1f9 (diff)
downloadold-guff-b1395163fa45ed788af4d2d003c1dd49846d86ee.tar.bz2
old-guff-b1395163fa45ed788af4d2d003c1dd49846d86ee.zip
add model mapper and stub post and tag models
Diffstat (limited to 'src/guff/handlers.cr')
-rw-r--r--src/guff/handlers.cr38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/guff/handlers.cr b/src/guff/handlers.cr
index 4ebeae7..6eeb389 100644
--- a/src/guff/handlers.cr
+++ b/src/guff/handlers.cr
@@ -8,54 +8,54 @@ module Guff
HANDLERS = [{
# TODO: add production error handler
env: %w{development},
- init: ->(model : Model) {
+ init: ->(models : Models) {
HTTP::ErrorHandler.new as HTTP::Handler
},
}, {
- init: ->(model : Model) {
+ init: ->(models : Models) {
HTTP::LogHandler.new as HTTP::Handler
},
}, {
- init: ->(model : Model) {
+ init: ->(models : Models) {
HTTP::DeflateHandler.new as HTTP::Handler
},
}, {
env: %w{development},
- init: ->(model : Model) {
- TestHandler.new(model) as HTTP::Handler
+ init: ->(models : Models) {
+ TestHandler.new(models) as HTTP::Handler
},
}, {
- init: ->(model : Model) {
- APIHandler.new(model) as HTTP::Handler
+ init: ->(models : Models) {
+ APIHandler.new(models) as HTTP::Handler
},
}, {
- init: ->(model : Model) {
- BlogHandler.new(model) as HTTP::Handler
+ init: ->(models : Models) {
+ BlogHandler.new(models) as HTTP::Handler
},
}, {
- init: ->(model : Model) {
- SlugHandler.new(model) as HTTP::Handler
+ init: ->(models : Models) {
+ SlugHandler.new(models) as HTTP::Handler
},
}, {
- init: ->(model : Model) {
- HTTP::StaticFileHandler.new(model.config["public"]) as HTTP::Handler
+ init: ->(models : Models) {
+ HTTP::StaticFileHandler.new(models.config["public"]) as HTTP::Handler
},
}, {
- init: ->(model : Model) {
- NotFoundHandler.new(model) as HTTP::Handler
+ init: ->(models : Models) {
+ NotFoundHandler.new(models) as HTTP::Handler
},
}]
- def self.get(model : Model) : Array(HTTP::Handler)
+ def self.get(models : Models) : Array(HTTP::Handler)
HANDLERS.select { |h|
if h.has_key?(:env)
- (h[:env] as Array(String)).includes?(model.config["environment"])
+ (h[:env] as Array(String)).includes?(models.config["environment"])
else
true
end
}.map { |h|
- init = (h[:init] as Proc(Model, HTTP::Handler))
- init.call(model)
+ init = (h[:init] as Proc(Models, HTTP::Handler))
+ init.call(models)
}
end
end