express-csv icon indicating copy to clipboard operation
express-csv copied to clipboard

Convert monkey-patching into middleware

Open niftylettuce opened this issue 10 years ago • 0 comments

It'd be great to have this as middleware which would add to res object the csv method.

For example:

var expressCsv = require('express-csv')

// ...

app.use(expressCsv)

// ... or only apply it to some routes ...

app.get('/some-route', expressCsv, function(req, res, next) {
  res.csv([ { a: 1, b: 2 } ])
})

niftylettuce avatar Jun 14 '14 02:06 niftylettuce