forked from BitsNbytes-JIT/bitsnbytes-staging
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
33 lines (23 loc) · 645 Bytes
/
index.js
File metadata and controls
33 lines (23 loc) · 645 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
const express = require("express");
const passport = require("passport");
require("dotenv").config()
const connectDB = require('./database/connection');
const users = require("./routes/api/users");
const app = express();
// express middleware
app.use(
express.urlencoded({
extended: false
})
);
app.use(express.json());
// Connect to MongoDB
connectDB()
// Passport middleware
app.use(passport.initialize());
// Passport config
require("./config/passport")(passport);
// Routes
app.use("/api/users", users);
const port = process.env.PORT || 5000;
app.listen(port, () => console.log(`Server up and running on port ${port} !`));