Skip to content

055 - API Routes

REST API route definitions. This is an example of a MAML document.

maml
{
  base_url: "/api/v2"
  routes: [
    {
      method: "POST"
      path: "/posts"
      handler: "getUsers"
      auth: false
    }

    {
      method: "PUT"
      path: "/comments"
      handler: "listProducts"
      auth: false
    }

    {
      method: "POST"
      path: "/comments/:id"
      handler: "deletePosts"
      auth: true
    }

    {
      method: "POST"
      path: "/users/:id"
      handler: "updateUsers"
      auth: true
    }

    {
      method: "PATCH"
      path: "/posts"
      handler: "deleteUsers"
      auth: false
    }

    {
      method: "GET"
      path: "/products"
      handler: "listOrders"
      auth: false
    }
  ]
}

See Also