Before anything, its my first question on stackoverflow, so im sorry if something isnt
correct.
Here is my repository: https://github.com/Ellisarm/FLASH Details about the app: in index.js file i am using express and i am importing from scrapers.js and meciuri&ids.js 2 functions in which i am scraping 2 arrays. Each functions is used with either app.post or app.get. I assigned a path also to them.
So basically, i want to enter on a http and get some data from there, data which is scraped thanks to puppeteer.
I've tried to deploy the application on heroku, but i didnt recieve the data, i have errors. I've made a lot of research before questioning this...
THIS is my index.js file
const express = require('express')
const cors = require('cors')
const scrapeProduct = require('./scrapers.js')
const scrapeProductSecond = require('./meciuri&ids.js')
const app = express()
const port = 8081
app.use(cors())
app.use(express.json())
app.post('/puppeteer', async (req, res) => {
const cote = await scrapeProduct(req.body.url)
console.log(cote);
res.status(201).send(cote)
})
app.get('/', async(req, res) =>{
const {echipeAcasa} = await scrapeProductSecond()
const {echipeDeplasare} = await scrapeProductSecond()
const {theIds} = await scrapeProductSecond()
console.log(typeof echipeAcasa, typeof echipeDeplasare, typeof theIds);
console.log( echipeAcasa, echipeDeplasare, theIds);
res.status(201).send([echipeAcasa, echipeDeplasare, theIds])
})
app.listen(process.env.PORT || port, ()=> console.log("Example app listening on port " + port))
I would appreciate even a link where i can research more or even a idea... thanks