-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
36 lines (28 loc) · 817 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
const express = require("express");
const cors = require("cors");
const mongoose = require("mongoose");
const cloudinary = require("cloudinary").v2;
const app = express();
app.use(cors());
app.use(express.json());
mongoose.connect("mongodb://localhost:27017");
cloudinary.config({
cloud_name: "dkemlj8lb",
api_key: "651799129757548",
api_secret: "yarlMBsodPfnKP7I103hKFuXLjs",
});
app.get("/", (req, res) => {
console.log("route/");
res.status(200).json({ message: "route /" });
});
const userRoutes = require("./routes/user");
app.use(userRoutes);
const offerRoutes = require("./routes/offer");
app.use(offerRoutes);
app.all("*", (req, res) => {
console.log("route not found");
res.status(404).json({ message: "route not found" });
});
app.listen(4000, () => {
console.log("server ON!");
});