Files
parcer/scraper/src/main.js
2024-04-18 21:39:02 +05:30

22 lines
531 B
JavaScript

import Fastify from 'fastify'
import cors from '@fastify/cors'
import fetch from 'node-fetch';
import playwright from 'playwright'
const fastify = Fastify();
// Change this later
const corsOptions = {
origin: 'http://localhost:5173'
}
await fastify.register(cors, corsOptions)
fastify.get('/', async (request, reply) => {
reply.send('Welcome to the Playwright Scraper API');
});
await fastify.listen(3000, (err, address) => {
if (err) throw err;
console.log(`Server listening on ${fastify.server.address().port}`)
});