Skip to content
This repository was archived by the owner on Feb 20, 2025. It is now read-only.

Routers

Dmytro edited this page Jan 30, 2017 · 2 revisions

app - is an instance of App class, which has a handlers methods, such as: get(), post(), put(), patch(), delete(), all().

This methods builded using lambda expressions, and has some parameters such as:

path: "/" - way which handled,

lambda with 'req', 'res' arguments: (req, res) -> {}

In body of lambda you may use 'req' and 'res' objects, which contains some methods for requests processing, and similar response methods.

get("/", (req, res) -> {
    // GET request
});

post("/", (req, res) -> {
    // POST request
});

put("/", (req, res) -> {
    // PUT request
});

patch("/", (req, res) -> {
    // PATCH request
});

delete("/", (req, res) -> {
    // DELETE request
});

all("/", (req, res) -> {
    // Handle of the all types of requests
});

Clone this wiki locally