refactor: support inrupt coding standards

This commit is contained in:
Joachim Van Herwegen
2020-05-20 17:27:54 +02:00
parent 5def53180c
commit f8e136cadb
25 changed files with 722 additions and 604 deletions

22
src/server/HttpHandler.ts Normal file
View File

@@ -0,0 +1,22 @@
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>;
}