| import express from "express"; |
| import http from "http"; |
| import dotenv from "dotenv"; |
| import { connectDB } from "./db.js"; |
| import authRoutes from "./routes/auth.js"; |
| import uploadRoutes from "./routes/upload.js"; |
| import adminRoutes from "./routes/admin.js"; |
| import { initAdminWS } from "./ws/adminWs.js"; |
|
|
| dotenv.config(); |
| await connectDB(); |
|
|
| const app = express(); |
| app.use(express.json()); |
|
|
| app.use("/auth", authRoutes); |
| app.use("/upload", uploadRoutes); |
| app.use("/admin", adminRoutes); |
|
|
| const server = http.createServer(app); |
| initAdminWS(server); |
|
|
| server.listen(3000, () => |
| console.log("🚀 BACKEND FINAL RUNNING ON :3000") |
| ); |
|
|