Skip to main content

Variable: Middlewares

const Middlewares: object

Defined in: src/index.ts:21

Type declaration

json()

readonly json: (options?: OptionsJson) => NextHandleFunction = express.json

Returns middleware that only parses json and only looks at requests where the Content-Type header matches the type option.

Parameters

ParameterType
options?OptionsJson

Returns

NextHandleFunction

Name

json

Constant

Description

This is a built-in middleware function in Express. It parses incoming requests with JSON payloads and is based on body-parser.

Returns middleware that only parses JSON and only looks at requests where the Content-Type header matches the type option. This parser accepts any Unicode encoding of the body and supports automatic inflation of gzip and deflate encodings.

See

Express Docs: express.json([options])

static

readonly static: RequestHandlerConstructor<Response<any, Record<string, any>>> = express.static

Name

static

Constant

Description

This is a built-in middleware function in Express. It serves static files and is based on serve-static.

The root argument specifies the root directory from which to serve static assets. The function determines the file to serve by combining req.url with the provided root directory. When a file is not found, instead of sending a 404 response, it instead calls next() to move on to the next middleware, allowing for stacking and fall-backs.

See

Express Docs: express.static(root, [options])

urlEncoded()

readonly urlEncoded: (options?: OptionsUrlencoded) => NextHandleFunction = express.urlencoded

Returns middleware that only parses urlencoded bodies and only looks at requests where the Content-Type header matches the type option

Parameters

ParameterType
options?OptionsUrlencoded

Returns

NextHandleFunction

Name

urlEncoded

Constant

Description

This is a built-in middleware function in Express. It parses incoming requests with urlencoded payloads and is based on body-parser.

Returns middleware that only parses urlencoded bodies and only looks at requests where the Content-Type header matches the type option. This parser accepts only UTF-8 encoding of the body and supports automatic inflation of gzip and deflate encodings.

See

Express Docs: express.urlencoded([options])