| 12345678910111213141516171819 |
- using Astralis;
- using Invercargill;
- void main() {
- var router = new Router();
- var server = new Server(8080, router);
-
- router.map_get("/hello", (context) => {
- print("Handling /hello\n");
- return new BufferedHttpResult.from_string("Hello from Astralis!");
- });
- router.map_get("/json", (context) => {
- print("Handling /json\n");
- return new BufferedHttpResult.from_string("{ \"message\": \"Hello JSON\" }", StatusCode.OK, Iterate.single<HttpHeader>(new HttpHeader("Content-Type","application/json")));
- });
- server.run();
- }
|