Skip to content

Routes

Layeron supports these route methods:

  • app.get(path, handler)
  • app.get(path, options, handler)
  • app.post(path, handler)
  • app.post(path, options, handler)
  • app.put(path, handler)
  • app.put(path, options, handler)
  • app.patch(path, handler)
  • app.patch(path, options, handler)
  • app.delete(path, handler)
  • app.delete(path, options, handler)
  • app.head(path, handler)
  • app.head(path, options, handler)
  • app.routeOptions(path, handler)
  • app.routeOptions(path, options, handler)

Example:

Terminal window
app.get("/api/health", () => {
return { ok: true }
})
app.post("/signup", { use: [signupCaptcha] }, async () => {
return { accepted: true }
})
FieldTypeDescription
authRouteAuthPolicyRoute access policy.
useBackendRouteGuard[]Route guards, such as Captcha modules.
inputSchemaIdstringInput schema reference.
outputSchemaIdstringOutput schema reference.
observabilityobjectRoute-level observability policy.
metadataobjectExtra route metadata.

Public routes are handled by the Gateway runtime.