Chore: housekeeping

This commit is contained in:
Pieter Vander Vennet 2024-06-24 13:11:35 +02:00
parent 18e3e6f806
commit a3a7e74f56
94 changed files with 1273 additions and 1080 deletions

View file

@ -4,24 +4,25 @@ export interface Handler {
mustMatch: string | RegExp
mimetype: string
addHeaders?: Record<string, string>
handle: (path: string, queryParams: URLSearchParams, req: http.IncomingMessage) => Promise<string>
handle: (
path: string,
queryParams: URLSearchParams,
req: http.IncomingMessage
) => Promise<string>
}
class ServerUtils {
public static getBody(req: http.IncomingMessage): Promise<string> {
return new Promise<string>((resolve) => {
let body = '';
req.on('data', (chunk) => {
body += chunk;
});
req.on('end', () => {
let body = ""
req.on("data", (chunk) => {
body += chunk
})
req.on("end", () => {
resolve(body)
});
})
})
}
}
export class Server {