forked from MapComplete/MapComplete
Chore: housekeeping
This commit is contained in:
parent
18e3e6f806
commit
a3a7e74f56
94 changed files with 1273 additions and 1080 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue