Routing
Mage has simple and familiar routing. You can define routes for different HTTP methods and paths.
app.get("/books", (context) => {
context.json(StatusCode.OK, [{ title: "Book 1" }, { title: "Book 2" }]);
});
app.post("/books", (context) => {
context.text(StatusCode.OK, "Created book!");
});