Last active
August 29, 2015 13:56
-
-
Save guilleiguaran/8877758 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
import webcaret.application; | |
import heaploop.looping; | |
import std.string; | |
void main() { | |
loop ^^ { | |
auto app = new Application; | |
app.router.get("/") ^ (req, res) { | |
res.write("Hello World"); | |
}; | |
app.router.post("/posts/:id") ^ (req, res) { | |
res.write(format("Post %s created", req.params["id"])); | |
}; | |
app.router.get("/posts/:id") ^ (req, res) { | |
res.write(format("Post %s", req.params["id"])); | |
}; | |
app.serve("127.0.0.1", 1337); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment