Last active
January 3, 2016 00:08
-
-
Save wycats/8380393 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
fn main() { | |
do RoutedServer::serve |config, router| { | |
config.listen("127.0.0.1", 1337); | |
router.get("/hello", |_,res| res.write("hello world")); | |
router.get("/posts/:id", |req,res| { | |
res.write(format!("post {}", req.params["id"])) | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Line 3 was a bug. Line 8 probably should have a semicolon but
write()
returns()
so it doesn't matter.