-
Notifications
You must be signed in to change notification settings - Fork 3
/
app.js
45 lines (40 loc) · 1.18 KB
/
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
37
38
39
40
41
42
43
44
45
require("dotenv").config()
require("./config/conn")
const express = require("express")
const cookieParser = require("cookie-parser")
const app = express()
const fileUpload = require("express-fileupload")
const { auth } = require("express-openid-connect")
const config = {
authRequired: false,
auth0Logout: true,
baseURL: "http://localhost:3000",
clientID: "KirajKIwXoptDESruKIxoXhAUYvKTPOc",
issuerBaseURL: "https://dev-f5vbpjo77htazft8.us.auth0.com/",
secret: "LONG_RANDOM_STRING",
}
const userRoute = require("./routes/userRoute")
const homeRoute = require("./routes/homeRoute")
const cloudinary = require("cloudinary").v2
cloudinary.config({
cloud_name: process.env.CLOUD_NAME,
api_key: process.env.CLOUDINARY_API_KEY,
api_secret: process.env.CLOUDINARY_API_SECRET,
})
app.set("view engine", "hbs")
app.set("views", "./templates/views")
app.use(express.static("public"))
app.use(express.json())
app.use(express.urlencoded({ extended: true }))
app.use(cookieParser())
app.use(
fileUpload({
useTempFiles: true,
tempFileDir: "/tmp/",
})
)
app.use(auth(config))
//routes
app.use("/", userRoute)
app.use("/", homeRoute)
module.exports = app