You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

hace 3 días
123456789101112131415161718192021222324252627282930
  1. import cors from "cors";
  2. import dotenv from "dotenv";
  3. import express, { Express } from "express";
  4. import connectDB from "./lib/database";
  5. import { errorHandler } from "./middleware/error";
  6. import companyRoutes from "./routes/company";
  7. import userRoutes from "./routes/user";
  8. dotenv.config();
  9. const app: Express = express();
  10. const port = process.env.PORT || 3000;
  11. connectDB();
  12. app.use(cors());
  13. app.use(express.json());
  14. app.use("/api/company", companyRoutes);
  15. app.use("/api/user", userRoutes);
  16. app.use(errorHandler);
  17. app.get("/health", (req, res) => {
  18. res.status(200).json({ status: "ok" });
  19. });
  20. app.listen(port, () => {
  21. console.log(`⚡️ Server running at http://localhost:${port}`);
  22. });