METHODS

Documentation for Redweb 0.13.2. Install that exact version when following these examples.

Lowercase HTTP verb helpers passed straight to Express route registration.

Explain it like I’m five

METHODS is a spelling-safe list of HTTP verbs—the labels on requests that say whether they read, create, replace, change, or delete something.

When should I use it?

Use it in Redweb service definitions to avoid scattered uppercase strings and accidental unsupported verbs.

Follow the example

This API pattern illustrates the named surface; it may require application-owned classes, credentials, or assets. Start from a complete recipe for a runnable application.

js
const { METHODS } = require('redweb')
// METHODS.GET, METHODS.POST, METHODS.PUT, METHODS.DELETE
  1. A service definition pairs its path with a METHODS value.
  2. BaseHttpServer registers the matching Express operation.
  3. Requests with another verb do not accidentally invoke that service.

Methods and members

GET

Use with services array or Express: METHODS.GET

POST

Use with services array or Express: METHODS.POST

PUT

Use with services array or Express: METHODS.PUT

DELETE

Use with services array or Express: METHODS.DELETE

What should I watch for?

The HTTP verb is only one part of API semantics. Implement authentication, idempotency, validation, and appropriate status codes in the service.