-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
49 lines (37 loc) · 1.34 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
46
47
var express = require("express"),
bodyParser = require("body-parser"),
cookieParser = require("cookie-parser"),
session = require("express-session"),
flash = require("express-flash-2"),
dotenv = require("dotenv"),
morgan = require("morgan"),
ejs = require("ejs"),
firebase = require("firebase");
var routes = require("./routes/routes.js"),
app = express();
// Initialize Firebase
var config = {
apiKey: "AIzaSyDi-dpCBd-XTbc3a3JaA8vzO1jn4_vzETQ",
authDomain: "document-manager-ec280.firebaseapp.com",
databaseURL: "https://document-manager-ec280.firebaseio.com",
projectId: "document-manager-ec280",
storageBucket: "document-manager-ec280.appspot.com",
messagingSenderId: "621475035321"
};
firebase.initializeApp(config);
app.set("port", process.env.PORT || 3000);
//set the view engine with directory
app.set("views", (__dirname + "/views"));
app.set("view engine", "ejs");
app.use(morgan("dev"));
app.use(bodyParser.urlencoded({extended:false}));
app.use(bodyParser.json());
app.use(cookieParser("secret"));
app.use(session({
secret: "12$!45*&^98836673!!##6590",
resave: true,
saveUninitialized: true }));
app.use(flash());
app.use( routes);
app.use(express.static(__dirname + "/public"));
app.listen(3000, function(){console.log("server is running on port " + app.get("port"))});