feat: Replace express with native http module

* refactor: replace express with native http module

* fix: 404 when unhandled

* chore: removed express dependency

* chore: updated package-lock.json

* docs: added documentation for BaseHttpServerFactory

* chore: updated package-lock.json

Co-authored-by: Arthur Joppart <arthur@digita.ai>
This commit is contained in:
Stijn Taelemans
2021-02-11 10:15:40 +01:00
committed by GitHub
parent 0ffd332828
commit ce1f4300ff
9 changed files with 90 additions and 400 deletions

View File

@@ -1,6 +1,6 @@
import type { Server } from 'http';
import request from 'supertest';
import { ExpressHttpServerFactory } from '../../../src/server/ExpressHttpServerFactory';
import { BaseHttpServerFactory } from '../../../src/server/BaseHttpServerFactory';
import type { HttpHandler } from '../../../src/server/HttpHandler';
import type { HttpResponse } from '../../../src/server/HttpResponse';
@@ -11,11 +11,11 @@ const handler: jest.Mocked<HttpHandler> = {
}),
} as any;
describe('ExpressHttpServerFactory', (): void => {
describe('BaseHttpServerFactory', (): void => {
let server: Server;
beforeAll(async(): Promise<void> => {
const factory = new ExpressHttpServerFactory(handler);
const factory = new BaseHttpServerFactory(handler);
server = factory.startServer(5555);
});

View File

@@ -1,7 +1,7 @@
import type { Server } from 'http';
import request from 'supertest';
import WebSocket from 'ws';
import { ExpressHttpServerFactory } from '../../../src/server/ExpressHttpServerFactory';
import { BaseHttpServerFactory } from '../../../src/server/BaseHttpServerFactory';
import type { HttpHandlerInput } from '../../../src/server/HttpHandler';
import { HttpHandler } from '../../../src/server/HttpHandler';
import type { HttpRequest } from '../../../src/server/HttpRequest';
@@ -31,7 +31,7 @@ describe('SimpleWebSocketHandler', (): void => {
beforeAll(async(): Promise<void> => {
const httpHandler = new SimpleHttpHandler();
webSocketHandler = new SimpleWebSocketHandler();
const httpServerFactory = new ExpressHttpServerFactory(httpHandler);
const httpServerFactory = new BaseHttpServerFactory(httpHandler);
const webSocketServerFactory = new WebSocketServerFactory(httpServerFactory, webSocketHandler);
server = webSocketServerFactory.startServer(5556);
});