Create Route
Creates a new route in Cortado.js with specified method, path, middleware, and handler. Returns created route object.
https://api.cortado.com/v1/routing
Request
JSON
body with route details: method, path, middleware array, handler. Authentication is required to ensure the user’s permission.
Body Parameters
Parameters | Type | Description |
---|---|---|
| string | HTTP method (GET, POST, PUT, DELETE, etc.) |
| string | Route path (e.g., "/users/:id") |
| string[] | (Optional) List of middleware names |
| string | Handler function name |
Based on the steps above, your code might look something like this. It brings together the key concepts covered — from setup and configuration to routing, authentication, or event handling. Feel free to adapt it to suit your specific use case.
Response
Returns the newly created route object including ID and metadata.
Last updated on
Aug 30, 2025