Options
All
  • Public
  • Public/Protected
  • All
Menu

nextjs-api-common-middleware - v1.0.1

Index

Type aliases

AuthHandlerOptions

BearerAuthHandlerOptions

CatchHandler

CatchHandler: (req: PossiblyAuthedNextApiRequest, res: NextApiResponse, error: any) => Promise<void> | void

Type declaration

CorsOriginHandler

CorsOriginHandlerResult

CorsOriginHandlerResult: string | string[]

MiddlewareHandler

MiddlewareHandler: (handler: PossiblyAuthedNextApiHandler, opts?: any) => PossiblyAuthedNextApiHandler

Type declaration

MiddlewareRestHandler

MiddlewareRestHandler: (handlers: RestMiddlewareHandlers, opts?: RestHandlerOptions) => PossiblyAuthedNextApiHandler

OneHttpMethod

OneHttpMethod: keyof typeof HttpMethod

PossiblyAuthedNextApiHandler

PossiblyAuthedNextApiHandler: (req: PossiblyAuthedNextApiRequest, res: NextApiResponse) => Promise<void> | NextApiHandler

Type declaration

RestMiddlewareHandlers

RestMiddlewareHandlers: {}

Object key may be of type HttpMethod, value must be of type PossiblyAuthedNextApiHandler | NextApiHandler

example
{
    get: (req, res) => res.send('Hello world'),
    post: (req, res) => res.send(`Hello ${req.body.name || 'world'}`),
}

Type declaration

UserId

UserId: string | number | null | undefined

UserInfo

UserInfo: UserInfoObject | null | undefined

Functions

auth

catchHandlerError

chain

cors

createExport

  • createExport(_options?: MiddlewareOptions): { auth: (Anonymous function); cors: (Anonymous function); error: (Anonymous function); guard: (Anonymous function); rest: any; _: object }

guard

rest

Generated using TypeDoc