查不到相关资料,感觉是我node没配置好,求助
如图:
//App.js
var http = require('http'),
path = require('path'),
express = require('express'),
session = require('express-session'),
cookieParser = require('cookie-parser'),//调用express session必须的中间件
MongoStore = require('connect-mongo')(session),//存储session到mongo的中间件
mongoose = require('mongoose'),
bodyParser = require('body-parser'),//express依赖 用于解析数据格式(JSON/二进制/文本)
serveStatic = require('serve-static'),//express依赖 用于指定静态资源加载的路径
morgan = require('morgan'),//开发环境的日志输出工具
app = express(),
port = process.env.PORT || 8083;
var dburl = 'mongodb://127.0.0.1:27017/imooc';
mongoose.Promise = global.Promise;
mongoose.connect(dburl,{
useMongoClient: true
});
app.use(bodyParser.urlencoded({ extended: true }));//设置express中间件,对数据格式文本化
app.use(serveStatic('./app/views/'));
app.use(cookieParser());
app.use(session({
secret : 'lszh react secret ',
key : 'lszhReact',
resave: false,
saveUninitialized: true,
store : new MongoStore({
url : dburl,
collection : 'sessions'
})
}));
app.listen(port);
require('./config/routers')(app);//载入路由配置文件
拉丁的传说
哈士奇WWW
拉莫斯之舞
相关分类