Constants · In depth

METHODS

Lowercase HTTP verb helpers passed straight to Express route registration.

Explain it like I’m five

The simple mental model

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 it fits

When should I use it?

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

A practical API pattern

Follow the example

This pattern explains the named API. Application classes, credentials, and assets may need to be supplied; use a complete recipe for a runnable starting point.

Read this article as Markdown

JavaScript
const { METHODS } = require('redweb')
// METHODS.GET, METHODS.POST, METHODS.PUT, METHODS.DELETE
  1. 1

    A service definition pairs its path with a METHODS value.

  2. 2

    BaseHttpServer registers the matching Express operation.

  3. 3

    Requests with another verb do not accidentally invoke that service.

Surface area

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