mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
23 lines
667 B
TypeScript
23 lines
667 B
TypeScript
import { IncomingMessage, ServerResponse } from 'http';
|
|
|
|
/**
|
|
* An HTTP request handler.
|
|
*/
|
|
export interface HttpHandler {
|
|
/**
|
|
* Checks whether this handler supports the given request.
|
|
* @param req - The input request.
|
|
*
|
|
* @returns A promise that indicates if this request is supported after resolving.
|
|
*/
|
|
canHandle: (req: Request) => Promise<boolean>;
|
|
/**
|
|
* Handles the given request.
|
|
* @param req - The input request.
|
|
* @param res - The response needed for responding to the request.
|
|
*
|
|
* @returns A promise resolving when the handling is finished.
|
|
*/
|
|
handle: (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
}
|