TypeDoc all the thngs

This commit is contained in:
2021-03-25 08:50:13 -05:00
parent 7cb0546b01
commit fad1184afe
52 changed files with 976 additions and 3 deletions

View File

@@ -2,8 +2,12 @@ import {AppClass} from "../../lifecycle/AppClass"
import {Request} from "../lifecycle/Request"
import {ResponseObject} from "./Route"
/**
* Base class representing a middleware handler that can be applied to routes.
*/
export abstract class Middleware extends AppClass {
constructor(
/** The request that will be handled by this middleware. */
protected readonly request: Request
) { super() }
@@ -11,6 +15,13 @@ export abstract class Middleware extends AppClass {
return this.request
}
// Return void | Promise<void> to continue request
/**
* Apply the middleware to the request.
* If this returns a response factory or similar item, that will be sent
* as a response.
*
* If this returns `void | Promise<void>`, the request will continue to the
* next handler.
*/
public abstract apply(): ResponseObject
}