Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import express from 'express'
- const app = express()
- app.get('/import', async (req, res) => {
- var fs = require('fs')
- fs.createReadStream('./src/data.csv')
- .pipe(parse({
- delimiter: ',',
- skip_lines_with_error: true
- }))
- .on('error', function (err) { console.log(err) })
- .on('data', async function (row) {
- // do a lot of stuff here
- })
- res.status(200)
- })
- export const import = (req, res) => {
- var fs = require('fs')
- fs.createReadStream('./src/data.csv')
- .pipe(parse({
- delimiter: ',',
- skip_lines_with_error: true
- }))
- .on('error', function (err) { console.log(err) })
- .on('data', async function (row) {
- // do a lot of stuff here
- })
- res.status(200)
- }
- import express from 'express'
- const app = express()
- app.get('/import') // <-- ??
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement