Add basic response factories and helpers

This commit is contained in:
2021-03-08 10:07:10 -06:00
parent 3acc1bc83e
commit a9ffa771dc
15 changed files with 365 additions and 10 deletions

View File

@@ -33,7 +33,7 @@ export class HTTPServer extends Unit {
await new Promise<void>((res, rej) => {
this.server = createServer(this.handler)
this.server.listen(port, undefined, undefined, () => {
this.server.listen(port, () => {
this.logging.success(`Server listening on port ${port}. Press ^C to stop.`)
})
@@ -55,10 +55,8 @@ export class HTTPServer extends Unit {
public get handler() {
return async (request: IncomingMessage, response: ServerResponse) => {
const extolloReq = new Request(request, response)
await this.kernel.handle(extolloReq)
await extolloReq.response.send('Hi, from Extollo!!')
}
}
}