-
-
Save qszhu/b31fa84f47a4c17581ff1dc21daa7049 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```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