Skip to content
Anton edited this page Mar 2, 2020 · 10 revisions

Idio's based off Goa, but its middleware updates the context and application, so that the types are extended.

Application extends _goa.Application: The application with some additions.

Name Type Description Initial
constructor new () => Application Constructor method. -
context !Context The context object for each request. -
middleware !Array<!Middleware> The array with middleware used on the server. []
destroy () => !Promise<void> Terminate all active connections and close the server. -
use (middleware: !Middleware) => !Application Use the given middleware fn. Old-style middleware will be converted. -

Request extends _goa.Request: The Goa request with additional properties.

Name Type Description Initial
constructor new () => Request Constructor method. -
body Object Parsed body of the request, extract using Form Data or JSON Body middleware. null

Context extends _goa.Context: The extension to the standard Goa context with properties set by middleware.

Name Type Description Initial
constructor new () => Context Constructor method. -
request !Request The request instance specific to Idio. -
session (!Session | undefined) The session object for updating, if session was installed. Set the ctx.session to null to destroy the session. -
sessionOptions (!SessionConfig | undefined) The options used to create the session middleware. Deep cloned for each request. -
compress ?boolean A flag that can be added to explicitly set whether the response should be compressed by the compress middleware. null
files (!Array<_multipart.FormDataFile> | !Object<string, !Array<_multipart.FormDataFile>> | _multipart.FormDataFile) Files extracted from the request's form data. null
file _multipart.FormDataFile A single file extracted from the request's form data. null
_matchedRoute ?string When middleware was invoked by the router, this will set the url, e.g., user/:id. null
_matchedRouteName ?string When middleware was invoked by the router, this will set the route name if the route was created with a name. null
params ?Object The parameters extracted from the router. null
router ?Router An instance of the router if the middleware was invoked via it. null
mountPath ?string When serving files through mount, this property will be set to the mount prefix. null
_usage Array An array with accumulated usage events. null
neoluddite (pckg: string, item: string, props?: !Object) => void Records the item for usage via neoluddite.dev. -

Middleware(
  ctx: !Context,
  next=: !Function,
): (!Promise|void)

The function to handle requests which can be installed with the .use method.

  • ctx* !Context: The context.
  • next !Function (optional): The callback.
Clone this wiki locally