-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
49 lines (44 loc) · 1.36 KB
/
Copy pathapp.js
File metadata and controls
49 lines (44 loc) · 1.36 KB
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
/**
* Created by yang on 2017/10/30.
*/
"use strict";
//???????
const myexpress = require("express");
const bodyParser = require("body-parser"); //???post????
const path=require("path");
const myejs=require("ejs");
const logger = require("morgan");
var favicon = require('serve-favicon');
const session = require("express-session");
const cookieparse = require("cookie-parser");
//¡¤??????
const staffRoute = require("./router/staffRouter.js");
const jobRoute = require("./router/jobRouter.js");
const viewRoute = require("./router/viewRouter.js");
const app = myexpress();
//// cookie ?????????
app.use(cookieparse());
app.use(session({
name:"testapp", //?????name ????cookie??????????cookie ??name?connect.sid;
secret:"1234",
cookie:{maxAge:300000}, // ???¦Ë?????
rolling:true, //????cookie???????? ???????false
resave:true //???¡À??—¨
}));
//???post ?????????
app.use(bodyParser.urlencoded({extended:false}));
// ????????????????
app.use(logger("dev"));
app.use(favicon(__dirname + '/public/favicon.ico.png'));
app.set("views",__dirname+"/views");
app.engine("html",myejs.__express);//???????html????
app.set("view engine","html");
app.use(myexpress.static(path.join(__dirname,"public")));
//¡¤?????
app.use("/",viewRoute);
app.use("/staff",staffRoute);
app.use("/job",jobRoute);
//???????
app.listen(8888,function(){
console.log("service started");
})