-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
48 lines (34 loc) · 1.12 KB
/
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
42
43
44
45
46
const express = require("express");
const cors = require('cors');
const cookieParser = require('cookie-parser')
require("dotenv").config();
const mongoose = require("mongoose");
const userService = require("./route/userService");
const connectionService = require("./route/connectionService");
const postService = require("./route/postService");
const likeCommentService = require("./route/LikeCommentService");
const app = express();
app.use(cors({
origin: '*',
credentials: true,
}))
app.use(express.json());
app.use(cookieParser());
const PORT = process.env.PORT || 8000
mongoose
.connect(process.env.MONGO_URI)
.then(() => console.log("Connected to mongoo !"))
.catch((err) => console.log(err));
// user service
app.use('/v1/user', userService)
// followers
app.use('/v1/connection', connectionService)
// post
app.use('/v1/post', postService)
//like
app.use('/v1/post-action', likeCommentService)
app.get("/health-check", async function (req, res) {
return res.json({ status: 200, message: "100 % working " })
});
app.listen(PORT, async () =>{
console.log(`Server Running..${PORT}`)});