import "dotenv/config";
import express from "express";
import routes from "@/routes";
import morgan from "morgan";
import cors from "@/configs/cors";
import sequelize from "@/configs/sequelize";
import error from "@/middlewares/error";

sequelize();

const app = express();

app.use(express.urlencoded({ extended: false }));
app.use(express.json());
app.use(morgan("tiny"));
app.use(cors);

app.get("/", (req, res) => {
    res.status(200).send("hello, world!");
});

app.use("/v1", routes);
app.use(error);

export default app;
