Object that stores injectables
@Router
annotates the class that will handle incoming requests
AnnotatedRouter for interface definition
import { AnnotatedRouter, Router } from "@fork-git-it/annotatedjs";
@Router()
export class ExampleRouter implements AnnotatedRouter {
get(uri: string, handler: RequestHandler): AnnotatedRouter {
// configure router to handle GET request
return this;
}
put(uri: string, handler: RequestHandler): AnnotatedRouter {
// configure router to handle PUT request
return this;
}
post(uri: string, handler: RequestHandler): AnnotatedRouter {
// configure router to handle POST request
return this;
}
patch(uri: string, handler: RequestHandler): AnnotatedRouter {
// configure router to handle PATCH request
return this;
}
delete(uri: string, handler: RequestHandler): AnnotatedRouter {
// configure router to handle DELETE request
return this;
}
all(uri: string, handler: RequestHandler): AnnotatedRouter {
// configure router to handle all requests
return this;
}
handle(req: Request): Promise<Response> {
// handle incoming request using the router
}
}
Generated using TypeDoc
A class decorator that defines the router used by controllers