fusion-plugin-http-router
Version:
Registers http routes and handlers on the server.
31 lines (24 loc) • 707 B
JavaScript
// @flow
import type {Context} from 'fusion-core';
import {IKoaBodyOptions} from 'koa-body';
import {BodyParserOptionsToken, HttpHandlersToken} from './tokens';
import type {Match} from './utils/pathUtils';
export type DepsObjectType = {
bodyParserOptions: IKoaBodyOptions,
handlers: HandlersType,
};
export type DepsType = {
bodyParserOptions: typeof BodyParserOptionsToken,
handlers: typeof HttpHandlersToken,
};
export type HandlersType = {
[string]: {[string]: (args: Object, ctx: Context) => any},
};
export type PatternedPath = {
path: string,
pattern: RegExp,
keys: string[],
};
export type ServiceType = {
from: (ctx: Context) => {handler: null | Function, match: Match},
};