-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
30 lines (24 loc) · 714 Bytes
/
Copy pathapp.js
File metadata and controls
30 lines (24 loc) · 714 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
const express = require("express");
const session = require("express-session");
const passport = require("passport");
require("dotenv").config();
require("./config/passport");
const app = express();
app.use(
session({
secret: process.env.SESSION_SECRET,
resave: false,
saveUninitialized: false,
})
);
app.use(passport.initialize());
app.use(passport.session());
app.use("/auth", require("./routes/auth"));
app.get("/", (req, res) => {
res.send(
`<h2>Hello OAuth</h2><a href="/auth/facebook">Login with Facebook</a> | <a href="/auth/github">Login with GitHub</a>`
);
});
app.listen(process.env.PORT, () => {
console.log(`Server running at http://localhost:${process.env.PORT}`);
});