-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
29 lines (24 loc) · 857 Bytes
/
index.js
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
const express = require("express");
const cors = require("cors");
const app = express();
require("dotenv").config();
const mongoose = require('mongoose');
const userRoutes = require("./routes/users");
const authRoutes = require("./routes/auth");
const ProductCrudRoute = require("./routes/ProductCrudRoute");
const InvoiceCrudRoute = require("./routes/InvoiceCrudRoute");
app.use(cors());
app.use(express.json());
// routes
app.use("/api/users", userRoutes);
app.use("/api/auth", authRoutes);
app.use("/api/crud/product", ProductCrudRoute);
app.use("/api/crud/invoice", InvoiceCrudRoute);
const dbConnectFunc = require("./db/dbConnect");
dbConnectFunc()
.then(() =>
app.listen(process.env.PORT || 4080, () => {
console.log("Server Started");
})
)
.catch((e) => console.log(e.message, " ERR-index.js"));