This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const puppeteer = require('puppeteer'); | |
const PQueue = require('p-queue'); | |
const queue = new PQueue({ concurrency: 2 }); | |
const singleRunner = async (url) => { | |
const browser = await puppeteer.launch({ headless: false, executablePath: process.env.CHROME_PATH, }); | |
const page = await browser.newPage(); | |
await page.goto(url); | |
const title = await page.title(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var xlstojson = require("xls-to-json-lc"); | |
var xlsxtojson = require("xlsx-to-json-lc"); | |
function excelToJson(file) { | |
const ext = file.split(".").slice(-1)[0]; | |
if (ext === "xlsx") { | |
xlsxtojson( | |
{ | |
input: file, | |
output: `${__dirname}/output.json` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.use((req, res, next) => { | |
res.header("Access-Control-Allow-Origin", "*"); // "*" for public access and www.example.com for specific uses | |
res.header( | |
"Access-Control-Allow-Headers", | |
"Origin, X-Requested-With, Content-Type, Accept, Authorization" | |
); | |
if (req.method === 'OPTIONS') { | |
res.header('Access-Control-Allow-Methods', 'PUT, POST, PATCH, DELETE, GET'); | |
return res.status(200).json({}); | |
} |