-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
42 lines (42 loc) · 1.71 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
var express = require("express");
var jade = require("jade");
var session = require("express-session");
var join = require("path").join;
var connection = require(__dirname + "/schema/connectionTool.js");
var WaybillHandler = require(__dirname + "/schema/handlers/waybillHandler.js");
var LoginHandler = require(__dirname + "/schema/handlers/loginHandler.js");
var CheckUserAuthentication = require(__dirname + "/schema/handlers/checkAuthentication.js");
var bodyParser = require("body-parser");
var app = express();
var pubDir = join(__dirname,"/public");
app.use( express.static(pubDir) );
app.set("view engine", "jade");
app.set("views", pubDir+"/views");
app.use( bodyParser.urlencoded( {extended:true} ) );
app.use( bodyParser.json() );
app.use( session({
secret: 'MFMFMFKEY',
resave: false,
httpOnly: false,
saveUninitialized: true,
cookie: {
maxAge: 20*60*1000,
expires: 20*60*1000
}
}));
app.get("/waybill", CheckUserAuthentication.confirmAutho);
//app.get("/",CheckUserAuthentication.confirmAutho);
app.get("/login", CheckUserAuthentication.confirmAutho);
app.post("/doLogin", LoginHandler.login);
app.get("/getUserSession", CheckUserAuthentication.getUserSession);
app.get("/dosignout", CheckUserAuthentication.signout);
app.post("/addUsers", LoginHandler.addUsers);
app.post("/saveWaybill", WaybillHandler.saveWaybill);
app.get("/downloadXlsxFile", WaybillHandler.downloadXlsxFile);
app.post("/getWaybillsByCriteria", WaybillHandler.getWaybillsByCriteria);
app.post("/removeWaybill", WaybillHandler.removeWaybill);
app.post("/updateWaybill", WaybillHandler.updateWaybill);
app.get("/getWaybillByInvoice", WaybillHandler.getWaybillByInvoice);
var port = process.env.PORT || 3000;
//var port = 3006;
app.listen(port);