httpGet top-level constant

const httpGet = const HTTPMethod("get")

Binds an HTTPController responder method to HTTP GET.

HTTPController methods with this metadata will be invoked for HTTP GET requests if their HTTPPath arguments match the HTTPRequestPath.variables of the incoming request. For example, the following controller has two responder methods bound with this method. If the incoming request has a valid 'id' path variable, the getOneUser is called, otherwise, the getUsers is called.

    class UserController extends HTTPController {
      Future<Response> getUsers() async => new Response.ok(getAllUsers());
      Future<Response> getOneUser(@HTTPPath("id") int id) async => new Response.ok(getUser(id));


const HTTPMethod httpGet = const HTTPMethod("get")