1 Star 0 Fork 0

mygoare/nodejs-blog

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
app.js 1.09 KB
一键复制 编辑 原始数据 按行查看 历史
mygoare 提交于 2013-07-12 10:36 . first commit
/**
* Module dependencies.
*/
var express = require('express'),
routes = require('./routes'),
http = require('http'),
path = require('path'),
MongoStore = require('connect-mongo')(express),
settings = require('./settings'),
flash = require('connect-flash');
var app = express();
// all environments
app.set('port', process.env.PORT || 3000);
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
app.use(flash());
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.cookieParser());
app.use(express.session({
secret: settings.cookieSecret,
key: settings.db,
cookie: {maxAge: 1000 * 60 * 60 * 24 * 30},
store: new MongoStore({
db: settings.db
})
}));
app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));
// development only
if ('development' == app.get('env')) {
app.use(express.errorHandler());
}
routes(app);
http.createServer(app).listen(app.get('port'), function(){
console.log('Express server listening on port ' + app.get('port'));
});
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/mygoare/nodejs-blog.git
git@gitee.com:mygoare/nodejs-blog.git
mygoare
nodejs-blog
nodejs-blog
master

搜索帮助