@xylabs/express


SDK for base code for Api repos that use express and deploy on AWS ECS
Reference
@xylabs/express
Classes
| WrappedWinstonLogger | Wrap Winston logger methods to adapt to familiar console logging methods |
| Counters | Static counter registry for tracking named numeric metrics. |
| Profiler | Measures and records the execution duration of async operations by name. |
Interfaces
| RouteDefinition | Defines an Express route with its HTTP method, path, and handler(s). |
| Empty | Empty object type used as a default for request/response body generics. |
| LoggerOptions | Configuration options for creating a logger instance. |
| ExpressError | An Error with an optional HTTP status code for Express error handling. |
| Source | An object containing references to the source of the error |
| ApiError | - |
| HrefWithMeta | A link with an href and associated metadata. |
| IRelationshipSelfLink | A relationship link pointing to the relationship itself. |
| IRelationshipRelatedLink | A relationship link pointing to a related resource. |
| IRelationshipLinks | Contains the links for a JSON:API relationship. |
| IRelationshipData | Contains the resource linkage data for a JSON:API relationship. |
| ApiResourceIdentifierObject | Within a given API, each resource object's type and id pair MUST identify a single, unique resource. (The set of URIs controlled by a server, or multiple servers acting as one, constitute an API.) |
| ApiResourceObject | A JSON:API resource object with optional attributes, links, meta, and relationships. |
| JsonApi | JSON:API version and metadata descriptor. |
| ApiResponseBase | Base interface for all JSON:API responses, including optional links and metadata. |
| ApiDataResponse | A successful JSON:API response containing primary data and optional included resources. |
| ApiErrorResponse | A JSON:API error response containing one or more error objects. |
Type Aliases
| HttpMethod | Supported HTTP methods for route definitions. |
| NoReqParams | Default type for request route parameters. |
| NoResBody | Default type for response body when none is specified. |
| NoReqBody | Default type for request body when none is specified. |
| NoReqQuery | Default type for request query parameters. |
| NoLocals | Default type for response locals. |
| LoggerMeta | Metadata key-value pairs attached to log entries. |
| LoggerVerbosity | Application-level log verbosity levels. |
LogFunction | - |
Logger | - |
| ParseFunc | A function that parses a string value into the target type. |
| ApiLink | A JSON:API link, either a simple URL string or an object with href and metadata. |
| ApiLinks | A collection of named JSON:API links. |
| ResourceLinkage | Resource linkage in a compound document allows a client to link together all of the included resource objects without having to GET any URLs via links. Resource linkage MUST be represented as one of the following: • null for empty to-one relationships. • an empty array ([]) for empty to-many relationships. • a single resource identifier object for non-empty to-one relationships. • an array of resource identifier objects for non-empty to-many relationships. |
| RelationshipMeta | Non-standard metadata associated with a JSON:API relationship. |
| Relationship | The value of the relationships key MUST be an object (a "relationships object"). Members of the relationships object ("relationships") represent references from the resource object in which it’s defined to other resource objects. Relationships may be to-one or to-many. |
| ApiResponse | A JSON:API response, either a data response or an error response. |
Variables
Functions
| addRouteDefinitions | Registers an array of route definitions on an Express application. |
| asyncHandler | Wraps an async Express request handler to forward rejected promises to the error handler. |
| errorToJsonHandler | Express error handler that logs the error and sends a JSON response with the error message and status code. |
| getHttpHeader | Since there can be multiple of certain HTTP headers or to prevent ugliness if someone did send us multiple instances of a header we only expect one of, this method grabs the 1st/only one of the desired header |
| getDefaultLogger | Returns the singleton default logger instance, creating one if it does not exist. |
| getLogger | Returns a cached Winston-backed logger at the specified verbosity level. |
| compactObject | Returns a shallow copy of the object with all null and undefined values removed. |
tryParse | - |
| requestHandlerValidator | Factory for Express middleware that validates request and response objects using Zod schemas. |
| enableCaseSensitiveRouting | Enable case sensitivity. When enabled, "/Foo" and "/foo" are different routes. When disabled, "/Foo" and "/foo" are treated the same. |
| disableCaseSensitiveRouting | Disable case sensitivity. When enabled, "/Foo" and "/foo" are different routes. When disabled, "/Foo" and "/foo" are treated the same. |
| enableExpressDefaultPoweredByHeader | By default Express appends the X-Powered-By: Express header to all responses. Calling this method enables that behavior. |
| disableExpressDefaultPoweredByHeader | By default Express appends the X-Powered-By: Express header to all responses. Calling this method disables that behavior. |
| customPoweredByHeader | Express middleware that sets the X-Powered-By header to 'XYO'. |
| getJsonBodyParserOptions | Gets the default JSON Body Parser options merged with the supplied options with the supplied options taking precedence |
| getJsonBodyParser | Get a JSON Body Parser connect middleware handler |
| useRequestCounters | Registers middleware that increments per-path request counters and exposes a /stats endpoint. |
| responseProfiler | Connect middleware to enable profiling of response lifecycle timing. To effectively profile the response timing, this middleware needs to be called first when initializing your Express App |
| getResponseMetadata | Extracts response metadata from res.locals, computing profile duration if profiling was started. |
| standardErrors | Express error handler that logs the error and sends a JSON:API-compliant error response. |
| setRawResponseFormat | Flags the response to forgo the standard response envelope and return the raw response body to the client |
| clearRawResponseFormat | Clears any flags on the response, allowing the response to use the default standard response envelope |
| isRawResponseFormatSet | Checks if there are any flags on the response that would cause it to forgo the standard response envelope and return the raw response body to the client |
classes
Counters
@xylabs/express
Static counter registry for tracking named numeric metrics.
Constructors
Constructor
new Counters(): Counters;
Returns
Counters
Properties
counters | static | Record<string, number> | {} |
Methods
inc()
static inc(name: string, count?: number): void;
Parameters
name | string | undefined |
count | number | 1 |
Returns
void
max()
static max(name: string, count: number): void;
Parameters
Returns
void
min()
static min(name: string, count: number): void;
Parameters
Returns
void
Profiler
@xylabs/express
Measures and records the execution duration of async operations by name.
Constructors
Constructor
new Profiler(): Profiler;
Returns
Profiler
Properties
stats | Record<string, number> | {} |
Methods
profile()
profile<T>(name: string, promise: Promise<T>): Promise<T>;
Type Parameters
Parameters
name | string |
promise | Promise<T> |
Returns
Promise<T>
WrappedWinstonLogger
@xylabs/express
Wrap Winston logger methods to adapt to familiar
console logging methods
Implements
Constructors
Constructor
new WrappedWinstonLogger(winston: Logger): WrappedWinstonLogger;
Parameters
Returns
WrappedWinstonLogger
Properties
winston | readonly | Logger |
debug | public | LogFunction |
error | public | LogFunction |
info | public | LogFunction |
log | public | LogFunction |
trace | public | LogFunction |
warn | public | LogFunction |
functions
addRouteDefinitions
@xylabs/express
function addRouteDefinitions(app: Express, routeDefinitions: RouteDefinition<RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>>>[]): void;
Registers an array of route definitions on an Express application.
Parameters
app | Express | The Express application to register routes on. |
routeDefinitions | RouteDefinition<RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>>>[] | The route definitions to register. |
Returns
void
asyncHandler
@xylabs/express
function asyncHandler<P, ResBody, ReqBody, ReqQuery, Locals>(fn: RequestHandler<P, ResBody, ReqBody, ReqQuery, Locals>): (req: Request<P, ResBody, ReqBody, ReqQuery, Locals>, res: Response<ResBody, Locals>, next: NextFunction) => Promise<unknown>;
Wraps an async Express request handler to forward rejected promises to the error handler.
Type Parameters
Parameters
fn | RequestHandler<P, ResBody, ReqBody, ReqQuery, Locals> | The async request handler to wrap. |
Returns
A request handler that catches async errors and passes them to next().
(
req: Request<P, ResBody, ReqBody, ReqQuery, Locals>,
res: Response<ResBody, Locals>,
next: NextFunction): Promise<unknown>;
Parameters
req | Request<P, ResBody, ReqBody, ReqQuery, Locals> |
res | Response<ResBody, Locals> |
next | NextFunction |
Returns
Promise<unknown>
clearRawResponseFormat
@xylabs/express
function clearRawResponseFormat(res: Response): void;
Clears any flags on the response, allowing the response to
use the default standard response envelope
Parameters
res | Response | The response to set to the standard response format |
Returns
void
compactObject
@xylabs/express
function compactObject<T>(obj: T): T;
Returns a shallow copy of the object with all null and undefined values removed.
Type Parameters
T extends Record<string, unknown> |
Parameters
obj | T | The object to compact. |
Returns
T
A new object with only defined, non-null properties.
@xylabs/express
function customPoweredByHeader(
req: Request,
res: Response,
next: NextFunction): void;
Express middleware that sets the X-Powered-By header to 'XYO'.
Parameters
req | Request |
res | Response |
next | NextFunction |
Returns
void
disableCaseSensitiveRouting
@xylabs/express
function disableCaseSensitiveRouting(app: Express): void;
Disable case sensitivity. When enabled, "/Foo" and "/foo" are different
routes. When disabled, "/Foo" and "/foo" are treated the same.
Parameters
app | Express | The Express app to disable the header on. |
Returns
void
@xylabs/express
function disableExpressDefaultPoweredByHeader(app: Express): void;
By default Express appends the X-Powered-By: Express header to
all responses. Calling this method disables that behavior.
Parameters
app | Express | The Express app to disable the header on. |
Returns
void
enableCaseSensitiveRouting
@xylabs/express
function enableCaseSensitiveRouting(app: Express): void;
Enable case sensitivity. When enabled, "/Foo" and "/foo" are different
routes. When disabled, "/Foo" and "/foo" are treated the same.
Parameters
app | Express | The Express app to disable the header on. |
Returns
void
@xylabs/express
function enableExpressDefaultPoweredByHeader(app: Express): void;
By default Express appends the X-Powered-By: Express header to
all responses. Calling this method enables that behavior.
Parameters
app | Express | The Express app to disable the header on. |
Returns
void
errorToJsonHandler
@xylabs/express
function errorToJsonHandler(
error: ExpressError,
req: Request,
res: Response,
next: NextFunction): void;
Express error handler that logs the error and sends a JSON response with the error message and status code.
Parameters
error | ExpressError | The Express error to handle. |
req | Request | The incoming request. |
res | Response | The outgoing response. |
next | NextFunction | The next middleware function. |
Returns
void
getDefaultLogger
@xylabs/express
function getDefaultLogger(): Logger;
Returns the singleton default logger instance, creating one if it does not exist.
Returns
Logger
The default logger.
@xylabs/express
function getHttpHeader(header: string, req: Request): string | undefined;
Since there can be multiple of certain HTTP headers or
to prevent ugliness if someone did send us multiple
instances of a header we only expect one of, this
method grabs the 1st/only one of the desired header
Parameters
header | string | The header to find |
req | Request | The received HTTP request (with headers) |
Returns
string | undefined
The first or only occurrence of the specified HTTP header
getJsonBodyParser
@xylabs/express
function getJsonBodyParser(options?: OptionsJson): NextHandleFunction;
Get a JSON Body Parser connect middleware handler
Parameters
options | OptionsJson | DefaultJsonBodyParserOptions | The options for the JSON Body Parser |
Returns
NextHandleFunction
A middleware function that parses JSON bodies
getJsonBodyParserOptions
@xylabs/express
function getJsonBodyParserOptions(options?: Partial<OptionsJson>): OptionsJson;
Gets the default JSON Body Parser options merged with the supplied options
with the supplied options taking precedence
Parameters
options? | Partial<OptionsJson> | The options to override the default JSON Body Parser options with |
Returns
OptionsJson
The combined JSON Body Parser options with the supplied values taking
precedence over the default
getLogger
@xylabs/express
function getLogger(minVerbosity?: LoggerVerbosity): Logger;
Returns a cached Winston-backed logger at the specified verbosity level.
Parameters
minVerbosity | LoggerVerbosity | 'info' | The minimum log level to output. Defaults to 'info'. |
Returns
Logger
A logger instance configured for the given verbosity.
getResponseMetadata
@xylabs/express
function getResponseMetadata(res: Response): Record<string, unknown>;
Extracts response metadata from res.locals, computing profile duration if profiling was started.
Parameters
res | Response | The Express response to extract metadata from. |
Returns
Record<string, unknown>
The metadata record including any profiling information.
isRawResponseFormatSet
@xylabs/express
function isRawResponseFormatSet(res: Response): boolean;
Checks if there are any flags on the response that would cause it
to forgo the standard response envelope and return the raw response
body to the client
Parameters
Returns
boolean
True if there are any flags on the response, false otherwise
requestHandlerValidator
@xylabs/express
function requestHandlerValidator<TParams, TQuery, TBody, TResponse>(schemas?: Partial<{
body: TBody;
params: TParams;
query: TQuery;
response: TResponse;
}>): (handler: (req: Request<output<TParams>, output<TResponse>, output<TBody>, output<TQuery>>, res: Response<output<TResponse>>, next: NextFunction) => unknown) => RequestHandler;
Factory for Express middleware that validates request and response objects using Zod schemas.
Type Parameters
TParams extends | ZodObject<{ }, $catchall<ZodUnion<readonly [ZodString, ZodArray<ZodString>]>>> | ZodType<Record<string, string>, unknown, $ZodTypeInternals<Record<string, string>, unknown>> | ZodObject<{ }, $catchall<ZodUnion<readonly [ZodString, ZodArray<ZodString>]>>> |
TQuery extends | ZodObject<{ }, $catchall<ZodUnion<readonly [ZodString, ZodArray<ZodString>]>>> | ZodType<Record<string, string | string[]>, unknown, $ZodTypeInternals<Record<string, string | string[]>, unknown>> | ZodObject<{ }, $catchall<ZodUnion<readonly [ZodString, ZodArray<ZodString>]>>> |
TBody extends ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>> | ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>> |
TResponse extends ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>> | ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>> |
Parameters
schemas? | Partial<{ body: TBody; params: TParams; query: TQuery; response: TResponse; }> | The Zod schemas to use for validation. |
Returns
A middleware function for validating requests and responses.
(handler: (req: Request<output<TParams>, output<TResponse>, output<TBody>, output<TQuery>>, res: Response<output<TResponse>>, next: NextFunction) => unknown): RequestHandler;
Parameters
handler | (req: Request<output<TParams>, output<TResponse>, output<TBody>, output<TQuery>>, res: Response<output<TResponse>>, next: NextFunction) => unknown |
Returns
RequestHandler
responseProfiler
@xylabs/express
function responseProfiler(
_req: Request,
res: Response,
next: NextFunction): void;
Connect middleware to enable profiling of response lifecycle timing. To effectively profile
the response timing, this middleware needs to be called first when initializing your Express
App
Parameters
_req | Request | The request |
res | Response | The response |
next | NextFunction | The next function |
Returns
void
Example
const app = express()
app.use(responseProfiler)
setRawResponseFormat
@xylabs/express
function setRawResponseFormat(res: Response): void;
Flags the response to forgo the standard response envelope
and return the raw response body to the client
Parameters
res | Response | The response to disable the standard response format on |
Returns
void
standardErrors
@xylabs/express
function standardErrors(
err: ExpressError | undefined,
req: Request,
res: Response,
next: NextFunction): void;
Express error handler that logs the error and sends a JSON:API-compliant error response.
Parameters
err | ExpressError | undefined | The error to handle, or undefined if no error. |
req | Request | The incoming request. |
res | Response | The outgoing response. |
next | NextFunction | The next middleware function. |
Returns
void
tryParse
@xylabs/express
function tryParse<T>(func: ParseFunc<T>, value?: string):
| T & {
}
| undefined;
Type Parameters
Parameters
Returns
| T & {
}
| undefined
Deprecated
use zod instead
useRequestCounters
@xylabs/express
function useRequestCounters(app: Application): void;
Registers middleware that increments per-path request counters and exposes a /stats endpoint.
Parameters
app | Application | The Express application to attach counters to. |
Returns
void
interfaces
ApiDataResponse
@xylabs/express
A successful JSON:API response containing primary data and optional included resources.
Extends
Type Parameters
Properties
ApiError
@xylabs/express
Properties
code? | string | An application-specific error code, expressed as a string value. |
detail? | string | A human-readable explanation specific to this occurrence of the problem. Like title, this field's value can be localized. |
id? | string | A unique identifier for this particular occurrence of the problem. |
links? | ApiLinks | A links object containing the following members: about: a link that leads to further details about this particular occurrence of the problem |
meta? | Record<string, unknown> | A meta object containing non-standard meta-information about the error. |
source? | Source | An object containing references to the source of the error, optionally including any of the following members: |
status? | string | The HTTP status code applicable to this problem, expressed as a string value. |
title? | string | A short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization. |
ApiErrorResponse
@xylabs/express
A JSON:API error response containing one or more error objects.
Extends
Properties
ApiResourceIdentifierObject
@xylabs/express
Within a given API, each resource object's type and id pair MUST identify a single, unique resource.
(The set of URIs controlled by a server, or multiple servers acting as one, constitute an API.)
Extended by
Properties
id | string | The id member is not required when the resource object originates at the client and represents a new resource to be created on the server. |
type | string | The type member is used to describe resource objects that share common attributes and relationships. The values of type members MUST adhere to the same constraints as member names. |
ApiResourceObject
@xylabs/express
A JSON:API resource object with optional attributes, links, meta, and relationships.
Extends
Properties
id | string | The id member is not required when the resource object originates at the client and represents a new resource to be created on the server. | ApiResourceIdentifierObject.id |
type | string | The type member is used to describe resource objects that share common attributes and relationships. The values of type members MUST adhere to the same constraints as member names. | ApiResourceIdentifierObject.type |
attributes? | Record<string, unknown> | An attributes object representing some of the resource's data. | - |
links? | ApiLinks | A links object containing links related to the resource. | - |
meta? | Record<string, unknown> | A meta object containing non-standard meta-information about a resource that can not be represented as an attribute or relationship. | - |
relationships? | Record<string, Relationship> | A relationships object describing relationships between the resource and other JSON:API resources. | - |
ApiResponseBase
@xylabs/express
Base interface for all JSON:API responses, including optional links and metadata.
Extended by
Properties
Empty
@xylabs/express
Empty object type used as a default for request/response body generics.
ExpressError
@xylabs/express
An Error with an optional HTTP status code for Express error handling.
Extends
Properties
HrefWithMeta
@xylabs/express
A link with an href and associated metadata.
Properties
href | string |
meta | Record<string, unknown> |
IRelationshipData
@xylabs/express
Contains the resource linkage data for a JSON:API relationship.
Properties
IRelationshipLinks
@xylabs/express
Contains the links for a JSON:API relationship.
Properties
IRelationshipRelatedLink
@xylabs/express
A relationship link pointing to a related resource.
Properties
related | string | A related resource link |
IRelationshipSelfLink
@xylabs/express
A relationship link pointing to the relationship itself.
Properties
self | string | A link for the relationship itself (a "relationship link"). This link allows the client to directly manipulate the relationship. For example, removing an author through an article’s relationship URL would disconnect the person from the article without deleting the people resource itself. When fetched successfully, this link returns the linkage for the related resources as its primary data. |
JsonApi
@xylabs/express
JSON:API version and metadata descriptor.
Properties
meta? | Record<string, unknown> |
version? | "1.0" | "1.1" |
LoggerOptions
@xylabs/express
Configuration options for creating a logger instance.
Properties
RouteDefinition
@xylabs/express
Defines an Express route with its HTTP method, path, and handler(s).
Type Parameters
H extends RequestHandler | RequestHandler |
Properties
handlers | H | H[] |
method | HttpMethod |
path | string | RegExp |
Source
@xylabs/express
An object containing references to the source of the error
Properties
parameter? | string | A string indicating which URI query parameter caused the error. |
pointer? | string | A JSON Pointer [RFC6901] to the associated entity in the request document [e.g. "/data" for a primary data object, or "/data/attributes/title" for a specific attribute]. |
type-aliases
ApiLink
@xylabs/express
type ApiLink = string | HrefWithMeta;
A JSON:API link, either a simple URL string or an object with href and metadata.
ApiLinks
@xylabs/express
type ApiLinks = Record<string, ApiLink>;
A collection of named JSON:API links.
ApiResponse
@xylabs/express
type ApiResponse<T> =
| ApiDataResponse<T>
| ApiErrorResponse;
A JSON:API response, either a data response or an error response.
Type Parameters
HttpMethod
@xylabs/express
type HttpMethod = "get" | "post" | "put" | "patch" | "delete" | "options" | "head";
Supported HTTP methods for route definitions.
LogFunction
@xylabs/express
type LogFunction = XyLabsLogFunction;
Deprecated
use from @xylabs/logger instead
Logger
@xylabs/express
type Logger = XyLabsLogger;
Deprecated
use from @xylabs/logger instead
LoggerMeta
@xylabs/express
type LoggerMeta = Record<string, string | number>;
Metadata key-value pairs attached to log entries.
LoggerVerbosity
@xylabs/express
type LoggerVerbosity = "error" | "warn" | "info" | "debug" | "all";
Application-level log verbosity levels.
NoLocals
@xylabs/express
type NoLocals = Record<string, any>;
Default type for response locals.
NoReqBody
@xylabs/express
type NoReqBody = Empty;
Default type for request body when none is specified.
NoReqParams
@xylabs/express
type NoReqParams = ParamsDictionary;
Default type for request route parameters.
NoReqQuery
@xylabs/express
type NoReqQuery = Query;
Default type for request query parameters.
NoResBody
@xylabs/express
type NoResBody = Empty;
Default type for response body when none is specified.
ParseFunc
@xylabs/express
type ParseFunc<T> = (value: string) => T;
A function that parses a string value into the target type.
Type Parameters
Parameters
Returns
T
Relationship
@xylabs/express
type Relationship =
| IRelationshipLinks
| IRelationshipData
| RelationshipMeta;
The value of the relationships key MUST be an object (a "relationships object"). Members of the relationships object ("relationships")
represent references from the resource object in which it’s defined to other resource objects.
Relationships may be to-one or to-many.
RelationshipMeta
@xylabs/express
type RelationshipMeta = Record<string, unknown>;
Non-standard metadata associated with a JSON:API relationship.
ResourceLinkage
@xylabs/express
type ResourceLinkage =
| null
| []
| ApiResourceIdentifierObject
| ApiResourceIdentifierObject[];
Resource linkage in a compound document allows a client to link together all of the included resource objects without having to GET any URLs via links.
Resource linkage MUST be represented as one of the following:
• null for empty to-one relationships.
• an empty array ([]) for empty to-many relationships.
• a single resource identifier object for non-empty to-one relationships.
• an array of resource identifier objects for non-empty to-many relationships.
variables
DefaultJsonBodyParserOptions
@xylabs/express
const DefaultJsonBodyParserOptions: OptionsJson;
The default options for the JSON Body Parser
DefaultJsonBodyParserOptionsLimit
@xylabs/express
const DefaultJsonBodyParserOptionsLimit: "100kb" = '100kb';
The default maximum request body size for the JSON Body Parser
DefaultJsonBodyParserOptionsTypes
@xylabs/express
const DefaultJsonBodyParserOptionsTypes: string[];
The default MIME types for the JSON Body Parser
EmptyParamsZod
@xylabs/express
const EmptyParamsZod: ZodObject<{
}, $catchall<ZodString>>;
Empty Zod schema for requests with no parameters.
EmptyQueryParamsZod
@xylabs/express
const EmptyQueryParamsZod: ZodObject<{
}, $catchall<ZodUnion<readonly [ZodString, ZodArray<ZodString>]>>>;
Empty Zod schema for requests with no query parameters.
ValidateRequestDefaults
@xylabs/express
const ValidateRequestDefaults: {
params: ZodObject<{
}, $catchall<ZodString>>;
query: ZodObject<{
}, $catchall<ZodUnion<readonly [ZodString, ZodArray<ZodString>]>>>;
body: ZodOptional<ZodJSONSchema>;
response: ZodOptional<ZodJSONSchema>;
};
Default validation schemas for request handler validator.
Type Declaration
params | ZodObject<{ }, $catchall<ZodString>> | EmptyParamsZod |
query | ZodObject<{ }, $catchall<ZodUnion<readonly [ZodString, ZodArray<ZodString>]>>> | EmptyQueryParamsZod |
body | ZodOptional<ZodJSONSchema> | - |
response | ZodOptional<ZodJSONSchema> | - |
jsonBodyParser
@xylabs/express
const jsonBodyParser: NextHandleFunction;
A JSON Body Parser middleware handler initialized with the default options
notImplemented
@xylabs/express
const notImplemented: RequestHandler;
Express request handler that responds with a 501 Not Implemented error.
standardResponses
@xylabs/express
const standardResponses: RequestHandler;
Connect middleware to enable the transform of all responses to match
the standard response format (compatible with JSON API)
Part of sdk-js
Maintainers
License
See the LICENSE file for license details
Credits
Made with 🔥 and ❄️ by XYLabs