Home Manual Reference Source

Typedef

Static Public Summary
public
public

Decorator: : function

public
public

ParamMiddlewareFunction(elem: *, route: Route, context: {ctx: KoaContext, body: Object, keyBody: string}): *: function

public
public
public
public

RouteParams: Object

public

StatusCode: Object

Static Public

public BeforeRouteParams: Object source

Properties:

NameTypeAttributeDescription
path string

the path at which the route will be available.

options ParamsMethodDecorator
call function

the fonction to call when route match, this is automaticaly add by route decorator

public Decorator: : function source

Return:

public OptionErrors: * source

Properties:

NameTypeAttributeDescription
logAll boolean
  • optional
  • default: false

if set to true, all logs will be displayed regardless of their individual settings

logErrorUnknown boolean
  • optional
  • default: false

whether unknown errors should be displayed

logErrorSequelize boolean
  • optional
  • default: false

whether errors pertaining to the models should be logged

logErrorApp boolean
  • optional
  • default: false

whether errors coming from thrown ErrorApp should be logged

public ParamMiddlewareFunction(elem: *, route: Route, context: {ctx: KoaContext, body: Object, keyBody: string}): *: function source

Params:

NameTypeAttributeDescription
elem *

the element the function will act upon

route Route
  • optional

the element's current route

context {ctx: KoaContext, body: Object, keyBody: string}
  • optional

the element's context

Return:

*

transformedParam the parameter, after being manipulated by the function

public ParamsClassDecorator: Object source

Properties:

NameTypeAttributeDescription
routeBase string

a prefix which will be preppended all to the route's path

disabled boolean

if set to true, all route in the class will be ignored

middlewares function[]

an array of Koa Middlewares, which will be mounted for the given route

accesses function[]

an array of async function, which will be call (for all routes in the class) with ctx, if one of them return true, the current client will access the route

public ParamsMethodDecorator: Object source

Properties:

NameTypeAttributeDescription
params Object<string, boolean|PostParamsFilter>

the params describing the route's middlewares, with the key being the param's name, and the value describes the way it should be handled. (only applicable for requests containing a body)

path string

the path at which the route will be available.
By default it will take the name of the function and replace uppercase by "-".
ex: a function name addUser will be mount with /add-user

disabled boolean

if set to true, the route will be ignored

middlewares function[]

an array of Koa Middlewares, which will be mounted for the given route

rateLimit Object

a rateLimit object, which lets the user describe the max rate at which a user can access the route

accesses function[]

an array of async function, which will be call with ctx, if one of them return true, the current client will access the route. This will overwrite the accesses pass to {ParamsClassDecorator}

public PostParamsFilter: Object source

Properties:

NameTypeAttributeDescription
__func ParamMiddlewareFunction[]

an array of functions which provides "middleware" functions that will be applied to the corresponding parameter one by one, in order to validate or transform it

__force boolean

whether the parameter is required or not.

public RouteParams: Object source

Properties:

NameTypeAttributeDescription
app Koa

the Koa application

prefix string

a prefix which will be preppended before every route's paths

routes Route[]

an array containing all the mounted Routes

models Model[]
  • optional

an array containing all of the app's models

model string
  • optional

the name of the route's own model

boolean disable
  • optional

whether the route should be disabled

public StatusCode: Object source

Properties:

NameTypeAttributeDescription
ok Number

HTTP response 200

created Number

HTTP response 201

noContent Number

HTTP response 204

badRequest Number

HTTP response 400

unauthorized Number

HTTP response 401

forbidden Number

HTTP response 403

notFound Number

HTTP response 404

internalServerError Number

HTTP response 500