Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Set the following keys in the object passed to the Router.extend() method to define the API endpoint.

NameRequiredDescription
nametrueName of the route.
pathtrueEndpoint/path for the route.
enabledfalseSpecifies whether the route is enabled. If not, it won’t be registered, and won’t accept requests.
sortfalse

An integer that determines the order routes are registered. Routes with a higher sort value are prioritized and registered earlier. For example, say you have /route/:id and /route/foo. If the route with the wildcard has a higher sort than the static route, the static route runs. So create the first with a lower sort, and /route/foo routes properly, as does /api/bar.

methodtrueHTTP method (GET, POST, PUT, DELETE).
descriptiontrueDescription of the route.
actiontrue

The function that allows you to interact with API Builder APIs and models and send data to your template engine.

...

Renderer EngineFile Extension
EJS.ejs
Handlebars.hbs
Markdown.md
ReactJS.jsx

To use a template in the API Builder Route's logic, reference its filename without the extension. Because the template is referenced using the filename, you cannot have the same filename with multiple extensions.

...