-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
41 lines (30 loc) · 949 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
30
31
32
33
34
35
36
37
38
39
40
41
const express = require("express");
const app = express();
const router = require("./router/prodcuts");
require("dotenv").config();
const {PORT} = process.env;
// const path = require("path");
// app.set('view engine', 'ejs');
// app.set('view engine', 'ejs');
// app.set('views', path.join(__dirname, 'views'));
//db Connection
const {dbConnect} = require("./dbConnection")
dbConnect();
//middlewares
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
//routes
const productsRouter = require("./router/prodcuts");
app.use("/api/v1/products", productsRouter);
const productRouter = require("./router/product");
// const { log } = require("console");
app.use("/api/v1/product", productRouter);
// app.get("/api/v1/homepage", (req,res)=>{
// res.render("index")
// })
// app.get("/api/v1/forms", (req,res)=>{
// res.render("forms")
// })
app.listen(PORT, ()=>{
console.log(`Server is running at port ${PORT}`);
})