const express = require('express');
const app = express();
const routes = require('./routes/index');
require("dotenv").config();
const cors = require('cors');

const port = 4003;

app.use(cors({
  origin: "*",
  methods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"],
  allowedHeaders: ["DNT","User-Agent","X-Requested-With","If-Modified-Since","Cache-Control","Content-Type","Range","Authorization"],
  credentials: true,
  maxAge: 1728000
}));
app.use(express.json({ limit: '50mb' }));
app.use(express.urlencoded({ limit: '50mb' }));

app.use('/api', routes);

app.listen(port, () => {
    console.log(`Server listening on port ${port}`);
});