JSPM

express-export

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7
  • Score
    100M100P100Q25436F
  • License MIT

Export files

Package Exports

  • express-export

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (express-export) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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