Created
July 24, 2018 11:50
-
-
Save kunjee17/19a56866f95c93f71064b3033b933562 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| let topRouter = scope { | |
| pipe_through headerPipe | |
| not_found_handler (text "404") | |
| get "/" helloWorld | |
| get "/a" helloWorld2 | |
| getf "/name/%s" helloWorldName | |
| getf "/name/%s/%i" helloWorldNameAge | |
| //scopes can be defined inline to simulate `subRoute` combinator | |
| forward "/other" (scope { | |
| pipe_through otherHeaderPipe | |
| not_found_handler (text "Other 404") | |
| get "/" otherHelloWorld | |
| get "/a" otherHelloWorld2 | |
| }) | |
| // or can be defined separatly and used as HttpHandler | |
| forward "/api" apiRouter | |
| // same with controllers | |
| forward "/users" userController | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment