Permalink
Browse files

Update to the lastest express-yui

  • Loading branch information...
1 parent 5645863 commit 2782e6f5cfaa6c94d1d92e66981651cd0f8f6c34 @ericf committed Jul 29, 2013
Showing with 212 additions and 127 deletions.
  1. +12 −9 app.js
  2. +0 −28 middleware/expose-yui.js
  3. +0 −1 middleware/index.js
  4. +199 −88 npm-shrinkwrap.json
  5. +1 −1 package.json
View
21 app.js
@@ -5,7 +5,7 @@ var express = require('express'),
LocatorHandlebars = require('locator-handlebars'),
config = require('./conf/config'),
- app, middleware, routes, exposedRoutes, locator;
+ app, isDevelopment, middleware, routes, exposedRoutes, locator;
// -- Configure App ------------------------------------------------------------
@@ -27,36 +27,39 @@ app.locals({
typekit: config.typekit
});
+isDevelopment = isDevelopment;
+
// -- Configure YUI ------------------------------------------------------------
// Global PNM env config.
global.PNM = {};
PNM.CACHE = config.cache.server;
PNM.FLICKR = config.flickr;
-if (app.get('env') === 'development') {
- app.yui.debugMode({filter: 'raw'});
- app.yui.setCoreFromAppOrigin();
-}
-
// -- Middleware -----------------------------------------------------------
middleware = require('./middleware');
-if (app.get('env') === 'development') {
+if (isDevelopment) {
app.use(express.logger('tiny'));
}
app.use(express.compress());
app.use(express.favicon());
-app.use(middleware.exposeYUI(expyui));
+app.use(expyui.expose());
+
+if (isDevelopment) {
+ app.yui.setCoreFromAppOrigin();
+ app.use(expyui.debug({filter: 'raw'}));
+}
+
app.use(app.router);
app.use(middleware.slash());
app.use(expyui.static());
app.use(express.static(config.dirs.pub));
app.use(middleware.placeLookup('/places/'));
-if (app.get('env') === 'development') {
+if (isDevelopment) {
app.use(express.errorHandler({
dumpExceptions: true,
showStack : true
View
@@ -1,28 +0,0 @@
-module.exports = function (expyui) {
- return function (req, res, next) {
- var method = req.method.toLowerCase(),
- routes, match, noop;
-
- if (method !== 'get') {
- next();
- return;
- }
-
- routes = req.app.routes[method];
- match = routes && routes.some(function (r) {
- return r.match(req.url);
- });
-
- if (!match) {
- next();
- return;
- }
-
- expyui.expose().forEach(function (middleware) {
- var noop = function () {};
- middleware(req, res, noop);
- });
-
- next();
- };
-};
View
@@ -1,5 +1,4 @@
module.exports = {
- exposeYUI : require('./expose-yui'),
placeLookup: require('./place-lookup'),
slash : require('express-slash')
};
Oops, something went wrong.

0 comments on commit 2782e6f

Please sign in to comment.