Skip to content

255 - API Routes

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

maml
{
  base_url: "/api/v3"
  routes: [
    {
      method: "PUT"
      path: "/products/:id"
      handler: "createOrders"
      auth: false
    }

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

    {
      method: "PUT"
      path: "/posts/:id"
      handler: "deleteOrders"
      auth: false
    }

    {
      method: "PATCH"
      path: "/orders"
      handler: "updatePosts"
      auth: true
    }

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

    {
      method: "PUT"
      path: "/posts/:id"
      handler: "createUsers"
      auth: false
    }

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

See Also