@dkx/http-middleware-response
v0.3.1
Published
Response middleware for @dkx/http-server
Downloads
11
Readme
DKX/Http/Middleware/Response
Middleware for returning custom response for @dkx/http-server. Great for testing.
Installation
$ npm install --save @dkx/http-middleware-response
or with yarn
$ yarn add @dkx/http-middleware-response
Usage
const {Server} = require('@dkx/http-server');
const {responseMiddleware} = require('@dkx/http-middleware-response');
const app = new Server;
const responseOptions = {
statusCode: 200,
statusMessage: 'OK',
headers: {
'X-Custom-header': 'lorem ipsum'
},
body: 'hello world',
timeout: 500,
onRequest: function(request) {
console.log(request);
}
};
app.use(responseMiddleware(responseOptions));