Skip to content

Commit

Permalink
changing parser to remove quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
springdo committed Feb 13, 2020
1 parent d573932 commit ca5332c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions functions/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ const axios = require('axios');
const fm = require('front-matter');
const router = express.Router();
const {
parse
Parser
} = require('json2csv');

const bufferFrom = require('buffer-from')

const BASE_API_URL =
Expand Down Expand Up @@ -49,6 +50,11 @@ const opts = {
fields
};

const json2csvParser = new Parser({
quote: '',
fields
});

const options = {
headers: {
Authorization: `token ${process.env.GITHUB_TOKEN}`
Expand Down Expand Up @@ -114,7 +120,7 @@ router.get('/data', (req, res) => {
response.push(backOfCard);
});
// TODO - add parser for CSV
const csv = parse(response, opts);
const csv = json2csvParser.parse(response, opts);
// console.info(csv);
req.query.type == 'json' ?
res.header('Content-Type', 'application/json') : res.header('Content-Type', 'text/csv');
Expand Down

0 comments on commit ca5332c

Please sign in to comment.