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
|
var express = require('express'); var bodyParser = require('body-parser'); var session = require('express-session');
var app = express();
var urlencodedParser = bodyParser.urlencoded({ extended: false }) app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: false }));
app.use(express.static(path.resolve(__dirname, '../dist')));
app.use(session({ secret:'today is a holiday', resave:true, saveUninitialized:false, cookie:{ maxAge:1000*60*10 } }));
app.get('/*', function (req, res) { console.log("get " + req.url); res.sendFile(path.join(__dirname, '../dist', 'index.html')); });
app.listen(8081, function () { console.log('success listen... http://127.0.0.1:8081'); });
|