import cors from "cors";
import dotenv from "dotenv";
import helmet from "helmet";
import express from "express";
import { votingRoutes } from "./routes";

dotenv.config();

const { API_PORT } = process.env;

const app = express();
app.use(cors());
app.use(helmet());
app.use(express.json({ limit: "1kb" }));
app.use(express.urlencoded({ extended: true, limit: "1kb" }));
app.use("/api", votingRoutes());

app.listen(API_PORT, () => {
    console.info(`API listening on port ${API_PORT}`);
});