Added middleware section to README.md

This commit is contained in:
Sdogruyol 2015-11-13 21:23:05 +02:00
parent fb1d3c3a85
commit db48f40fe6
1 changed files with 15 additions and 0 deletions

View File

@ -115,6 +115,21 @@ Accessing the environment (query params, body, content_type, headers, status_cod
end
```
## Middlewares
You can create your own middlewares by inheriting from ```HTTP::Handler```
```crystal
class CustomHandler < HTTP::Handler
def call(request)
puts "Doing some custom stuff here"
call_next request
end
end
Kemal.config.add_handler CustomHandler.new
```
## Static Files
Kemal has built-in support for serving your static files. You need to put your static files under your ```/public``` directory.