Skip to content

Instantly share code, notes, and snippets.

@guilleiguaran
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guilleiguaran/8877758 to your computer and use it in GitHub Desktop.
Save guilleiguaran/8877758 to your computer and use it in GitHub Desktop.
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