express-export
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Express Export

npm version downloads size Coverage Status dependencies Status type license Code style

Installation

npm i express-export
# or
yarn add express-export

Example

Root file

const server = express();

ExpressExport.applyMiddleware(server);

Add router

const data = [
  { user: "Maxim", age: 22, location: "Moscow" },
  { user: "Valentina", age: 18 }
];
const fields = ["user", "age"];

server.get("/", function(req, res, next) {
  res.export({
    format: req.query.format as ExportFormat, // csv | xml | json
    filename: "users",
    data,
    fields,
    download: false
  });
});

License

MIT

Package Sidebar

Install

npm i express-export

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

10.3 kB

Total Files

5

Last publish

Collaborators

  • muzikanto