TypeDoc all the thngs
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user