import "dotenv/config";
import connectDB from "./config/db";
import express, { json } from "express";
import cors from "cors";
import mailRoute from "./routes/mail";
import projectRoute from "./routes/projects";
import uploadRoute from "./routes/upload";
import getRegionNameRoute from "./routes/getRegionName";

connectDB();

const app = express();
const port = process.env.PORT || 3003;

app.use(json());
app.use(cors({ origin: "*" }));

app.use("/mail", mailRoute);
app.use("/projects", projectRoute);
app.use("/upload", uploadRoute);
app.use("/getRegionName", getRegionNameRoute);

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