-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.js
36 lines (25 loc) · 827 Bytes
/
app.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 connectDB = require("./config/db");
const cors = require("cors");
const session = require("express-session");
const passport = require("passport");
const product = require("./routes/api/product");
const farmer = require("./routes/api/farmer")
const app = express();
app.use(session({
secret: "Our little secret.",
resave: false,
saveUninitialized: false
}));
app.use(passport.initialize());
app.use(passport.session());
connectDB();
app.use(cors({origin: true, credentials: true}));
app.use(express.json({extended: false}));
app.get("/", (req, res) => {
res.send("Hello World");
});
app.use("/api/product", product);
app.use("/api/farmer", farmer);
const PORT = process.env.PORT || 5000;
app.listen(PORT, () => console.log(`Server running on port ${PORT}`));