Skip to content

Instantly share code, notes, and snippets.

@qszhu qszhu/onyxroutes.cr Secret
Created May 24, 2019

Embed
What would you like to do?
```crystal
require "onyx/http"
Onyx::HTTP.get "/" do |env|
env.response << "Hello, Onyx!"
end
Onyx::HTTP.post "/foo" do |env|
env.response << "bar"
end
Onyx::HTTP.listen do |handlers|
router_middleware = handlers[-2].as(Onyx::HTTP::Middleware::Router)
pp router_middleware.@hash.keys # ["/get", "/post/foo"]
end
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.