-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
35 lines (28 loc) · 836 Bytes
/
app.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
30
31
32
33
34
35
import express from "express";
import userRouter from "./routes/user.js";
import itemRouter from "./routes/inventory.js";
import mongoose from "mongoose";
import itemLogRoutes from "./routes/itemLog.js";
import OTProuter from "./routes/otp.js";
import {config} from "dotenv";
export const app = express();
config({
path: "./data/config.env",
});
// Using Middlewares
app.use(express.json());
app.use("/users", userRouter);
app.use("/items", itemRouter);
app.use("/otp", OTProuter);
app.use("/api/itemlog", itemLogRoutes);
mongoose.connect('mongodb://localhost:27017/inventoryDB', {
useNewUrlParser: true,
useUnifiedTopology: true
});
const PORT = process.env.PORT || 5000;
app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}`);
});
app.get("/", (req, res)=>{
res.send("Nice working");
});