Constants · In depth

ENCODINGS

Supported request-body parser names for HTTP server configuration.

Explain it like I’m five

The simple mental model

ENCODINGS is a tiny menu that lets you choose whether request bodies arrive as JSON or traditional URL-encoded form data.

When it fits

When should I use it?

Use the constants when configuring HTTP body parsing so spelling stays aligned with supported Redweb values.

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 { ENCODINGS } = require('redweb')
// ENCODINGS.json, ENCODINGS.urlencoded
  1. 1

    The selected constant is passed in HttpServer options.

  2. 2

    Redweb installs the corresponding Express body parser.

  3. 3

    Route handlers then read the parsed value from req.body.

Surface area

Methods and members

json

Use Express JSON body parsing.

urlencoded

Use Express URL-encoded body parsing.