File size: 899 Bytes
97000f9
 
 
 
 
 
 
 
 
 
 
 
 
 
5c9e8a6
 
 
 
97000f9
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import express from "express";
import cors from "cors";
import dotenv from "dotenv";
import authRoutes from "./routes/auth";
import productRoutes from "./routes/products";
import dashboardRoutes from "./routes/dashboard";
import userRoutes from "./routes/users";

dotenv.config();

const app = express();
app.use(cors());
app.use(express.json());

app.get("/", (_req, res) => {
  res.json({ ok: true, message: "IQMath backend is running" });
});

app.get("/health", (_req, res) => {
  res.json({ ok: true, service: "iqmath-backend" });
});

app.use("/api/auth", authRoutes);
app.use("/api/products", productRoutes);
app.use("/api/dashboard", dashboardRoutes);
app.use("/api/users", userRoutes);

const port = Number(process.env.PORT || 5000);
app.listen(port, () => {
  // eslint-disable-next-line no-console
  console.log(`IQMath backend listening on ${port}`);
});