Miss any of our Open RFC calls?Watch the recordings here! »

@dkx/http-middleware-response

0.3.1 • Public • Published

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));

Keywords

none

Install

npm i @dkx/http-middleware-response

DownloadsWeekly Downloads

0

Version

0.3.1

License

MIT

Unpacked Size

6.85 kB

Total Files

12

Last publish

Collaborators

  • avatar