forked from PSPDFKit/pspdfkit-server-example-nodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
33 lines (30 loc) · 889 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
var express = require("express");
var path = require("path");
var logger = require("morgan");
var config = require("./config");
var bodyParser = require("body-parser");
var cookieParser = require("cookie-parser");
var session = require("express-session");
var app = express();
// config
app.set("views", path.join(__dirname, "views"));
app.set("view engine", "ejs");
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(cookieParser());
app.use(
session({
secret: config.secret,
resave: false,
saveUninitialized: true
})
);
app.use(logger("dev"));
// routes
app.use(express.static(path.join(__dirname, "public")));
app.use(require("./routes/api"));
app.use(require("./routes/auth"));
app.use(require("./routes/login"));
app.use("/", require("./routes/documents"));
app.use("/upload", require("./routes/upload"));
module.exports = app;