Response.msgPack(jsObject)method on the standard ExpressJS Response object.
With auto-detection and transformation enabled, the middleware detects automatically the HTTP header
Accept: application/x-msgpack and piggybacks the
Response.json() method of the ExpressJS API, to encode the JSON response as Message Pack. This method is usefull, when you have existing applications that need use the middleware, without changing the codebase very much.
const msgpackResponse = ;app;app
Note: Remember the add the header
Accept: application/x-msgpackin the request.
Also it can have auto detection and transformation disabled. The middleware extends the
Response object of the ExpressJS framework, by adding the
msgPack() method to it. Then to return an encoded response, you just use the
const msgpackResponse = ;app;//orapp;app;
Note: Intialize the middleware before the actual routes in the middleware chain to properly extend the
Node.js >= 6.0
With npm do:
npm install msgpack-response -save
This project is funded and maintained by Mobiltron, Inc.. We ❤️ open source software!
See also the list of contributors who participated in this project.
msgpack-response is available under the MIT license. See the LICENSE file for more info.