mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Added middleware section to README.md
This commit is contained in:
parent
fb1d3c3a85
commit
db48f40fe6
1 changed files with 15 additions and 0 deletions
15
README.md
15
README.md
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue