-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.js
49 lines (41 loc) · 1.31 KB
/
server.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
46
47
48
49
const express = require("express");
const session = require("express-session");
const passport = require("./config/passport");
const routes = require("./routes");
const app = express();
const PORT = process.env.PORT || 8080;
const pug = require("pug");
const db = require("./models");
const path = require("path");
var compression = require("compression")
require("dotenv").config();
app.use(express.urlencoded({ extended: true }));
app.use(express.json());
// We need to use sessions to keep track of our user's login status
app.use(session({ secret: "keyboard cat", resave: true, saveUninitialized: true }));
app.use(passport.initialize());
app.use(passport.session());
app.use(express.static(path.join(__dirname, "client/Public")));
app.use(compression())
app.use(routes)
app.set("view engine", "pug");
app.set("views", __dirname + "/views");
db.sequelize.sync({ force: false }).then(function() {
// db.Users.create({
// login:"test",
// password:"Password1",
// email:"test@gmail.com",
// tier:"ADMIN"
// });
// app.get("api/admin/login",{login:"test",
// password:"Password1",})
// db.Users.create({
// login:"test2",
// password:"Password1",
// email:"test1@gmail.com",
// tier:"employee"
// })
app.listen(PORT, function() {
console.log("App listening on PORT " + PORT);
});
});