const express = require('express')
const app = express()

var bodyParser = require('body-parser');
app.use(bodyParser.json())

const puppeteer = require('puppeteer-extra');
const pluginStealth = require('puppeteer-extra-plugin-stealth');
puppeteer.use(pluginStealth())

const { chromium } = require('playwright');

const puppeteerMiddleware = require('./middleware/puppeteer');
const playwrightMiddleware = require('./middleware/playwright');

(async () => {

    app.use(puppeteerMiddleware(puppeteer));
    app.use(playwrightMiddleware(chromium));
    
    // main routes    
    app.use('/internApi/follow', require('./routes/follow'));
    app.use('/health', require('./routes/health'));
        
})();


module.exports = app