feature - added response module
ADD
src/response/index.ts
+export * from './response.handler';
+export * from './responseHeaders.factory';

ADD
src/response/response.handler.ts
+import * as http from 'http';
+import { HttpResponse, HttpHeaders } from '../http.interface';
+import { EffectResponse } from '../effects/effects.interface';
+import { headersFactory } from './responseHeaders.factory';
+
+export const handleResponse = (res: HttpResponse) => (effect: EffectResponse) => {
+ res.writeHead(effect.status, headersFactory(effect.headers));
+ res.end(JSON.stringify(effect.body));
+};

ADD
src/response/responseHeaders.factory.ts
+import { HttpHeaders } from '../http.interface';
+
+export const DEFAULT_HEADERS = {
+ 'Content-Type': 'application/json',
+};
+
+export const headersFactory = (headers?: HttpHeaders) => ({
+ ...DEFAULT_HEADERS,
+ ...headers,
+});

feature - added response module