Skip to content

043 - API Routes

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

maml
{
  base_url: "/api/v3"
  routes: [
    {
      method: "PATCH"
      path: "/orders/:id"
      handler: "createPosts"
      auth: true
    }

    {
      method: "GET"
      path: "/products/:id"
      handler: "updateOrders"
      auth: true
    }

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

    {
      method: "POST"
      path: "/users/:id"
      handler: "updateOrders"
      auth: false
    }

    {
      method: "PATCH"
      path: "/users"
      handler: "getProducts"
      auth: true
    }

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

    {
      method: "PATCH"
      path: "/posts"
      handler: "getOrders"
      auth: true
    }
  ]
}

See Also