diff --git a/example/account/index.js b/example/account/index.js index 0cb43e5..eb2805b 100644 --- a/example/account/index.js +++ b/example/account/index.js @@ -75,9 +75,9 @@ var Account = module.exports = Service.extend({ }, use: { - // tell micromono to use `partial-render` middleware at the server side + // tell micromono to use `layout` middleware at the server side // for request url matching `/account/:page`. - '/:page': 'partial-render' + 'layout': '/:page' }, /** diff --git a/example/home/index.js b/example/home/index.js index cbb5809..6fa7937 100644 --- a/example/home/index.js +++ b/example/home/index.js @@ -22,9 +22,9 @@ var Home = module.exports = Service.extend({ baseUrl: '/', use: { - // tell micromono to use `partial-render` middleware at the server side - // for request url matching `/account/:page?`. - '/:page?': 'partial-render' + // tell micromono to use `layout` middleware at the server side + // for request urls in the array. + 'layout': ['/private', '/public', '/$'] }, route: { diff --git a/example/io/index.js b/example/io/index.js index 3db43c6..4fb3a7c 100644 --- a/example/io/index.js +++ b/example/io/index.js @@ -9,9 +9,9 @@ var IO = module.exports = Service.extend({ baseUrl: '/io', use: { - // tell micromono to use `partial-render` middleware at the server side + // tell micromono to use `layout` middleware at the server side // for request url matching `/io/$`. - '/$': 'partial-render' + 'layout': '/$' }, route: { diff --git a/lib/micromono.js b/lib/micromono.js index 6bc7438..00e9c0e 100644 --- a/lib/micromono.js +++ b/lib/micromono.js @@ -243,10 +243,10 @@ function runService(micromono, app, ServiceFactory, callback) { } if (ann.use && app) { - Object.keys(ann.use).forEach(function(key) { - var name = ann.use[key]; - var middleware = require('./middleware/' + name); - serviceInstance.app.use(key, middleware(app)); + Object.keys(ann.use).forEach(function(middlewareName) { + var url = ann.use[middlewareName]; + var middleware = require('./middleware/' + middlewareName); + serviceInstance.app.use(url, middleware(app)); }); }