123456789101112131415161718192021222324252627282930 |
- import cors from "cors";
- import dotenv from "dotenv";
- import express, { Express } from "express";
- import connectDB from "./lib/database";
- import { errorHandler } from "./middleware/error";
-
- import companyRoutes from "./routes/company";
- import userRoutes from "./routes/user";
-
- dotenv.config();
-
- const app: Express = express();
- const port = process.env.PORT || 3000;
-
- connectDB();
-
- app.use(cors());
- app.use(express.json());
-
- app.use("/api/company", companyRoutes);
- app.use("/api/user", userRoutes);
- app.use(errorHandler);
-
- app.get("/health", (req, res) => {
- res.status(200).json({ status: "ok" });
- });
-
- app.listen(port, () => {
- console.log(`⚡️ Server running at http://localhost:${port}`);
- });
|