mercury-send
An Express/Connect-compatible middleware for sending HTTP responses
About
mercury-send
is a super simple middleware that provides (or overrides) a
res.send
function that you can use in other middleware/route handlers. You
can use it with Node's http.Server, Express, or any connect-compatible
framework. To get the most benefit, you'll want to use it in tandem with
mercury-schema which will
provide mercury-send
with a stringify function based on a pre-compiled
response schema.
Installation
❯ npm install @appjumpstart/mercury-send --save
Usage
const mercurySend = require('@appjumpstart/mercury-send')
app.use(mercurySend)
app.get('/', (req, res) => res.type('json').send({ message: 'Hello!' }))
Acknowledgement
mercury-send
is completely modeled around some of the features within the
excellent Fastify framework.