Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update express version #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 16 additions & 23 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
var express = require('express');
var path = require('path');
var fs = require('fs');
var logger = require('morgan');
var compression = require('compression');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');

var config = require('./config/admin');

var app = express();
Expand All @@ -7,31 +14,17 @@ var app = express();
var pub = __dirname + '/public';
var view = __dirname + '/views';

app.configure(function() {
app.set('view engine', 'html');
app.set('views', view);
app.engine('.html', require('ejs').__express);
app.use(compression());

app.use(express.methodOverride());
app.use(express.bodyParser());
app.set('basepath', __dirname);
});
app.use(logger(':method :url :response-time ms'));
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json({ type: '*/*' }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));

app.configure('development', function() {
app.use(express.static(pub));
app.use(express.errorHandler({
dumpExceptions: true,
showStack: true
}));
});

app.configure('production', function() {
var oneYear = 31557600000;
app.use(express.static(pub, {
maxAge: oneYear
}));
app.use(express.errorHandler());
});
app.set('view engine', 'html');
app.set('views', view);
app.engine('.html', require('ejs').__express);

app.on('error', function(err) {
console.error('app on error:' + err.stack);
Expand Down
18 changes: 11 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
{
"name": "pomelo-admin-web",
"version": "0.2.0",
"private": false,
"dependencies": {
"express": "<4.0.0",
"ejs": ">=0.0.1"
}
"name": "pomelo-admin-web",
"version": "0.2.0",
"private": false,
"dependencies": {
"body-parser": "^1.16.1",
"compression": "^1.6.2",
"cookie-parser": "^1.4.3",
"ejs": "2.5.6",
"express": "4.14.1",
"morgan": "^1.8.1"
}
}