var express = require('express');
var ecstatic = require('ecstatic');
var history = require('connect-history-api-fallback');
var app = express();
//设置允许跨域访问
app.all('*', function(req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
//Access-Control-Allow-Headers
res.header('Access-Control-Allow-Headers', 'Content-Type');
res.header('Access-Control-Allow-Methods', '*');
res.header('Content-Type', 'application/json;charset=utf-8');
next();
});
app.use(history());
app.use(ecstatic({ root: __dirname + '/dist' }));
app.listen(8888, () => {
console.log("http://localhost:8888");
});