-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
41 lines (20 loc) · 707 Bytes
/
server.js
File metadata and controls
41 lines (20 loc) · 707 Bytes
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 dotenv = require("dotenv").config();
const errorHandler = require("./middleware/errorHandler");
const connectDb = require("./config/dbConnection");
//RLGtppJAKXTPE1hr
const app = express();
connectDb();
// const app = express();
const port = process.env.PORT || 5000;
// app.get("/api/contacts", (req,res)=>{
// res.json( { message : "get all contacts" });
// } );
app.use(express.json());
app.use("/api/contacts", require("./routes/contactRoutes"));
//register and login.
app.use("/api/users", require("./routes/userRoutes"));
app.use(errorHandler);
app.listen(port, () => {
console.log(`Server running on port ${port}`);
});