Configuration
Package configuration and explanation
Middlewares
Type: MiddlewareConfig
Chain type: "main"
The middlewares
object is a key-value pair where the key is the route path and the value is an array of middleware functions. Each middleware function is an async function that takes a single argument, request
, which is an object containing the request details.
Global Middlewares
Type: GlobalMiddlewareConfig
Chain type: "before" | "after"
The globalMiddlewares
object is a key-value pair where the key is the middleware type and the value is an async function. The middleware type can be either before
or after
. The before
middleware function will be executed before any route middleware, and the after
middleware function will be executed after any route middleware.
Config object
Type: NemoConfig
The config
object is a key-value pair where the key is the configuration option and the value is the configuration value. The available configuration options are:
Prop | Type | Default |
---|---|---|
debug | boolean | false |
silent | boolean | false |
enableTiming | boolean | false |
errorHandler | ErrorHandler | undefined |
Example
Getting all of above informations together makes for us NEMO's full configuration representing all usable properites.
The createNEMO()
constructor is the entry point for the NEMO package. It allows you to create a middleware helper that can be used to define middleware functions for your Next.js application.