ENCODINGS

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

Supported request-body parser names for HTTP server configuration.

Explain it like I’m five

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

When should I use it?

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

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 { ENCODINGS } = require('redweb')
// ENCODINGS.json, ENCODINGS.urlencoded
  1. The selected constant is passed in HttpServer options.
  2. Redweb installs the corresponding Express body parser.
  3. Route handlers then read the parsed value from req.body.

Methods and members

json

Use Express JSON body parsing.

urlencoded

Use Express URL-encoded body parsing.

What should I watch for?

Body parsing is not schema validation. Limit body size and validate every field before using it.