Skip to content

1660 - API Routes

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

maml
{
  base_url: "/api/v2"
  routes: [
    {
      method: "POST"
      path: "/users/:id"
      handler: "updateOrders"
      auth: false
    }

    {
      method: "PUT"
      path: "/users"
      handler: "deletePosts"
      auth: false
    }

    {
      method: "PATCH"
      path: "/products/:id"
      handler: "getPosts"
      auth: true
    }

    {
      method: "GET"
      path: "/comments"
      handler: "listPosts"
      auth: true
    }

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

    {
      method: "PATCH"
      path: "/users/:id"
      handler: "createPosts"
      auth: false
    }
  ]
}

See Also