Express.js update.

This commit is contained in:
Your Name 2014-06-06 14:57:20 +02:00
parent 26f6ffb88e
commit caf732a04c
2 changed files with 8 additions and 3 deletions

View file

@ -4,7 +4,9 @@
"license": "MIT", "license": "MIT",
"dependencies": {}, "dependencies": {},
"devDependencies": { "devDependencies": {
"express": "~3.6.0", "body-parser": "~1.3.0",
"compression": "~1.0.6",
"express": "~4.4.1",
"glob": "~4.0.2", "glob": "~4.0.2",
"grunt": "~0.4.1", "grunt": "~0.4.1",
"grunt-autoprefixer": "~0.7.4", "grunt-autoprefixer": "~0.7.4",

View file

@ -2,13 +2,16 @@
angular.module('ffffng').factory('app', function (fs) { angular.module('ffffng').factory('app', function (fs) {
var express = require('express'); var express = require('express');
var bodyParser = require('body-parser');
var compress = require('compression');
var app = express(); var app = express();
app.use(express.bodyParser()); app.use(bodyParser());
var clientDir = __dirname + '/../client'; var clientDir = __dirname + '/../client';
app.use(express.compress()); app.use(compress());
app.use('/', express.static(clientDir + '/')); app.use('/', express.static(clientDir + '/'));
app.get('/', function (req, res, next) { app.get('/', function (req, res, next) {
fs.readFile(clientDir + '/index.html', 'utf8', function (err, body) { fs.readFile(clientDir + '/index.html', 'utf8', function (err, body) {