imp(core): #createServer - event$
MODIFY
packages/core/src/server/server.factory.ts
packages/core/src/server/server.factory.ts
@@ -10,24 +10,24 @@ export interface CreateServerConfig {
port?: number;
hostname?: string;
httpListener: ReturnType<typeof httpListener>;
- httpEventsHandler?: ServerEffect;
+ event$?: ServerEffect;
dependencies?: InjectionDependencies;
}
export const createServer = (config: CreateServerConfig) => {
- const { httpListener, httpEventsHandler, port, hostname, dependencies } = config;
+ const { httpListener, event$, port, hostname, dependencies } = config;
const { injector, routing } = httpListener.config;
const eventsSubscriber = subscribeServerEvents(port, hostname);
const server = http.createServer(httpListener);
- const events$ = eventsSubscriber(server).pipe(takeWhile(e => !isCloseEvent(e)));
+ const serverEvent$ = eventsSubscriber(server).pipe(takeWhile(e => !isCloseEvent(e)));
if (dependencies) {
injector.registerAll(dependencies)(server);
}
- if (httpEventsHandler) {
- httpEventsHandler(events$, server, injector.get).subscribe();
+ if (event$) {
+ event$(serverEvent$, server, injector.get).subscribe();
}
return {

MODIFY
packages/core/src/server/specs/server.factory.spec.ts
packages/core/src/server/specs/server.factory.spec.ts
@@ -119,7 +119,7 @@ describe('#createServer', () => {
// then
marbleServer = createServer({
httpListener: app,
- httpEventsHandler: event$ => forkJoin(
+ event$: event$ => forkJoin(
event$.pipe(filter(isErrorEvent), take(1)),
event$.pipe(filter(isClientErrorEvent), take(1)),
event$.pipe(filter(isConnectEvent), take(1)),

imp(core): #createServer - event$