Skip to content

Get

function Get(path: string): Function

Registers the decorated method as a handler for GET path.

Place this decorator on a method of a ControllerBase subclass. A single controller can have multiple methods decorated with different HTTP-method decorators.

path string · The URL path pattern to match (e.g. "/users/:id").

returns Function

Example:

class UsersController extends ControllerBase {
static deps = [];
static state = [];
@Get("/users/:id")
async getUser() {
return this.ok({ id: this.ctx.params.id });
}
}

Learn: Controller classes

Last updated: