Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

removing tunnelMiddleware in favor of the low level rpc middleware. m…

…oving fixtures and examples to use app.use() instead of application.json to define custom middleware.
  • Loading branch information...
commit 12993efbff3ab34dd02ca2c52196fefdf3249359 1 parent d17b0da
@caridy caridy authored
Showing with 36 additions and 133 deletions.
  1. +0 −1  examples/developer-guide/adding_view_engines/app.js
  2. +2 −1  examples/developer-guide/binding_events/app.js
  3. +4 −2 examples/developer-guide/binding_events/application.json
  4. +1 −1  examples/developer-guide/binding_events/middleware/mojito-contextualizer.js
  5. +0 −1  examples/developer-guide/configure_routing/app.js
  6. +0 −1  examples/developer-guide/dashboard/02_mojits/app.js
  7. +0 −1  examples/developer-guide/dashboard/03_frame_mojits/app.js
  8. +0 −1  examples/developer-guide/dashboard/04_composite_mojits/app.js
  9. +0 −1  examples/developer-guide/dashboard/05_getting_data/app.js
  10. +0 −1  examples/developer-guide/dashboard/06_testing/app.js
  11. +0 −1  examples/developer-guide/dashboard/07_binders/app.js
  12. +2 −0  examples/developer-guide/dashboard/trib/app.js
  13. +0 −1  examples/developer-guide/dashboard/trib/application.json
  14. +0 −2  examples/developer-guide/dashboard/trib/application.yaml
  15. +0 −1  examples/developer-guide/device_assets/app.js
  16. +0 −1  examples/developer-guide/device_views/app.js
  17. +0 −1  examples/developer-guide/framed_assets/app.js
  18. +0 −1  examples/developer-guide/framed_config/app.js
  19. +0 −1  examples/developer-guide/generating_urls/app.js
  20. +0 −1  examples/developer-guide/global_assets/app.js
  21. +0 −1  examples/developer-guide/hello/app.js
  22. +0 −1  examples/developer-guide/htmlframe_mojit/app.js
  23. +0 −1  examples/developer-guide/inter-mojit/app.js
  24. +0 −1  examples/developer-guide/locale_i18n/app.js
  25. +2 −1  examples/developer-guide/model_yql/app.js
  26. +4 −2 examples/developer-guide/model_yql/application.json
  27. +0 −1  examples/developer-guide/multiple_mojits/app.js
  28. +0 −1  examples/developer-guide/scroll_views/app.js
  29. +0 −1  examples/developer-guide/simple_assets/app.js
  30. +0 −1  examples/developer-guide/simple_config/app.js
  31. +0 −1  examples/developer-guide/simple_logging/app.js
  32. +0 −1  examples/developer-guide/simple_view/app.js
  33. +2 −1  examples/developer-guide/unittest_model_controller/app.js
  34. +4 −2 examples/developer-guide/unittest_model_controller/application.json
  35. +0 −1  examples/developer-guide/using_configs/app.js
  36. +0 −1  examples/developer-guide/using_cookies/app.js
  37. +0 −1  examples/developer-guide/using_parameters/app.js
  38. +0 −1  examples/developer-guide/yui_module/app.js
  39. +0 −1  examples/input/cookies/app.js
  40. +0 −2  examples/input/get/app.js
  41. +0 −1  examples/input/merged/app.js
  42. +0 −1  examples/input/post/app.js
  43. +0 −1  examples/input/route/app.js
  44. +0 −1  examples/newsboxes/app.js
  45. +0 −1  examples/quickstartguide/app.js
  46. +0 −1  examples/simple/part1/app.js
  47. +0 −1  examples/simple/part2/app.js
  48. +0 −1  examples/simple/part3/app.js
  49. +0 −1  examples/simple/part4/app.js
  50. +0 −1  examples/simple/part5/app.js
  51. +0 −1  examples/simple/part6/app.js
  52. +0 −1  examples/simple/part7/app.js
  53. +0 −1  examples/simple/part8/app.js
  54. +1 −1  lib/app/middleware/mojito-contextualizer.js
  55. +2 −3 lib/app/middleware/mojito-handler-error.js
  56. +2 −4 lib/app/middleware/mojito-handler-static.js
  57. +1 −1  lib/app/middleware/mojito-handler-tunnel-parser.js
  58. +5 −2 lib/app/middleware/mojito-handler-tunnel-rpc.js
  59. +1 −1  lib/app/middleware/mojito-handler-tunnel-specs.js
  60. +1 −1  lib/app/middleware/mojito-handler-tunnel-type.js
  61. +1 −1  lib/app/middleware/mojito-handler-tunnel.js
  62. +1 −3 lib/mojito.js
  63. +0 −40 lib/tunnel.js
  64. +0 −1  tests/fixtures/badfiles/app.js
  65. +0 −1  tests/fixtures/gsg5-appConfig/app.js
  66. +0 −1  tests/fixtures/gsg5/app.js
  67. +0 −1  tests/fixtures/store/app.js
  68. +0 −2  tests/func/applications/frameworkapp/common/app.js
  69. +0 −1  tests/func/applications/frameworkapp/configapp/app.js
  70. +0 −2  tests/func/applications/frameworkapp/routing/app.js
  71. +0 −1  tests/func/applications/frameworkapp/serveronly/app.js
  72. +0 −1  tests/func/applications/frameworkapp/usecase/app.js
  73. +0 −1  tests/func/applications/frameworkapp/yaml-config/app.js
  74. +0 −1  tests/func/applications/performanceapp/part1/app.js
  75. +0 −1  tests/func/applications/performanceapp/part2/app.js
  76. +0 −1  tests/func/applications/performanceapp/part3/app.js
  77. +0 −1  tests/func/applications/performanceapp/part4/app.js
  78. +0 −1  tests/func/applications/performanceapp/part5/app.js
  79. +0 −1  tests/func/applications/performanceapp/part6/app.js
  80. +0 −1  tests/func/applications/performanceapp/part7/app.js
View
1  examples/developer-guide/adding_view_engines/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
3  examples/developer-guide/binding_events/app.js
@@ -12,15 +12,16 @@
var debug = require('debug')('app'),
express = require('express'),
libmojito = require('../../../'),
+ customContextualizerMiddleware = require('./middleware/mojito-contextualizer.js'),
app;
app = express();
app.set('port', process.env.PORT || 8666);
libmojito.extend(app);
+app.use(customContextualizerMiddleware());
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
6 examples/developer-guide/binding_events/application.json
@@ -5,7 +5,6 @@
"cache": false,
"forceUpdate": true
},
- "middleware": ["middleware/mojito-contextualizer.js"],
"specs": {
"frame": {
"type": "HTMLFrameMojit",
@@ -18,5 +17,8 @@
}
}
},
- { "settings": [ "environment:development" ], "selector": "mocked" }
+ {
+ "settings": [ "environment:development" ],
+ "selector": "mocked"
+ }
]
View
2  examples/developer-guide/binding_events/middleware/mojito-contextualizer.js
@@ -1,4 +1,4 @@
-module.exports = function(config) {
+module.exports = function() {
var url = require('url'),
query;
return function(req, res, next) {
View
1  examples/developer-guide/configure_routing/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  examples/developer-guide/dashboard/02_mojits/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  examples/developer-guide/dashboard/03_frame_mojits/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  examples/developer-guide/dashboard/04_composite_mojits/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  examples/developer-guide/dashboard/05_getting_data/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  examples/developer-guide/dashboard/06_testing/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  examples/developer-guide/dashboard/07_binders/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
2  examples/developer-guide/dashboard/trib/app.js
@@ -12,12 +12,14 @@
var debug = require('debug')('app'),
express = require('express'),
libmojito = require('../../../../'),
+ customContextualizerMiddleware = require('./middleware/mojito-contextualizer.js'),
app;
app = express();
app.set('port', process.env.PORT || 8666);
libmojito.extend(app);
+app.use(customContextualizerMiddleware());
app.use(libmojito.middleware());
app.get('/', function (req, res, next) {
View
1  examples/developer-guide/dashboard/trib/application.json
@@ -2,7 +2,6 @@
{
"settings": [ "master" ],
"appPort": "8666",
- "middleware": ["middleware/mojito-contextualizer.js"],
"staticHandling": {
"appName": "trib"
},
View
2  examples/developer-guide/dashboard/trib/application.yaml
@@ -2,8 +2,6 @@
- settings:
- master
appPort: '8666'
- middleware:
- - middleware/mojito-contextualizer.js
staticHandling:
appName: trib
yui:
View
1  examples/developer-guide/device_assets/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  examples/developer-guide/device_views/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  examples/developer-guide/framed_assets/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  examples/developer-guide/framed_config/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  examples/developer-guide/generating_urls/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  examples/developer-guide/global_assets/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  examples/developer-guide/hello/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  examples/developer-guide/htmlframe_mojit/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  examples/developer-guide/inter-mojit/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  examples/developer-guide/locale_i18n/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
3  examples/developer-guide/model_yql/app.js
@@ -12,15 +12,16 @@
var debug = require('debug')('app'),
express = require('express'),
libmojito = require('../../../'),
+ customContextualizerMiddleware = require('./middleware/mojito-contextualizer.js'),
app;
app = express();
app.set('port', process.env.PORT || 8666);
libmojito.extend(app);
+app.use(customContextualizerMiddleware());
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
6 examples/developer-guide/model_yql/application.json
@@ -1,7 +1,6 @@
[
{
"settings": [ "master" ],
- "middleware": ["middleware/mojito-contextualizer.js"],
"specs": {
"frame": {
"type": "HTMLFrameMojit",
@@ -21,5 +20,8 @@
}
}
},
- { "settings": [ "environment:development" ], "selector": "mocked" }
+ {
+ "settings": [ "environment:development" ],
+ "selector": "mocked"
+ }
]
View
1  examples/developer-guide/multiple_mojits/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  examples/developer-guide/scroll_views/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  examples/developer-guide/simple_assets/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  examples/developer-guide/simple_config/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  examples/developer-guide/simple_logging/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  examples/developer-guide/simple_view/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
3  examples/developer-guide/unittest_model_controller/app.js
@@ -12,15 +12,16 @@
var debug = require('debug')('app'),
express = require('express'),
libmojito = require('../../../'),
+ customContextualizerMiddleware = require('./middleware/mojito-contextualizer.js'),
app;
app = express();
app.set('port', process.env.PORT || 8666);
libmojito.extend(app);
+app.use(customContextualizerMiddleware());
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
6 examples/developer-guide/unittest_model_controller/application.json
@@ -1,7 +1,6 @@
[
{
"settings": [ "master" ],
- "middleware": [ "middleware/mojito-contextualizer.js" ],
"specs": {
"frame": {
"type": "HTMLFrameMojit",
@@ -21,5 +20,8 @@
}
}
},
- { "settings": [ "environment:development" ], "selector": "mocked" }
+ {
+ "settings": [ "environment:development" ],
+ "selector": "mocked"
+ }
]
View
1  examples/developer-guide/using_configs/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  examples/developer-guide/using_cookies/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  examples/developer-guide/using_parameters/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  examples/developer-guide/yui_module/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  examples/input/cookies/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
2  examples/input/get/app.js
@@ -20,8 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
-
// Example usage on how to execute anonymous mojit.
app.get('/:mojitType/:mojitAction', function (req, res, next) {
View
1  examples/input/merged/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
// "root": {
// "verbs": ["post"],
View
1  examples/input/post/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  examples/input/route/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
// This shows an example how to setup route params for specific paths
// Previously, this was done via `routes.json` using the `params` property.
View
1  examples/newsboxes/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  examples/quickstartguide/app.js
@@ -19,7 +19,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
// regex paths should be defined in `app.js`.
app.get(/\/|index.html/, libmojito.dispatch('shelf.index'));
View
1  examples/simple/part1/app.js
@@ -21,7 +21,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/:type/:action', function (req, res, next) {
libmojito.dispatch(req.params.type + '.' + req.params.action)(req, res, next);
View
1  examples/simple/part2/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/:type/:action', function (req, res, next) {
libmojito.dispatch(req.params.type + '.' + req.params.action)(req, res, next);
View
1  examples/simple/part3/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/:type/:action', function (req, res, next) {
libmojito.dispatch(req.params.type + '.' + req.params.action)(req, res, next);
View
1  examples/simple/part4/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/:type/:action', function (req, res, next) {
libmojito.dispatch(req.params.type + '.' + req.params.action)(req, res, next);
View
1  examples/simple/part5/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/:type/:action', function (req, res, next) {
libmojito.dispatch(req.params.type + '.' + req.params.action)(req, res, next);
View
1  examples/simple/part6/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  examples/simple/part7/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/:type/:action', function (req, res, next) {
libmojito.dispatch(req.params.type + '.' + req.params.action)(req, res, next);
View
1  examples/simple/part8/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
2  lib/app/middleware/mojito-contextualizer.js
@@ -131,7 +131,7 @@ function RequestContextualizer() {
var defaultLang;
- return function (req, res, next) {
+ return function middlewareMojitoContextualizer(req, res, next) {
if (!defaultLang && req.app && req.app.mojito) {
View
5 lib/app/middleware/mojito-handler-error.js
@@ -11,11 +11,10 @@
/**
Export a middleware error handler.
-@param {Object} The configuration.
@return {Object} The handler.
**/
-module.exports = function (config) {
- return function (err, req, res, next) {
+module.exports = function () {
+ return function middlewareMojitoHandlerError(err, req, res, next) {
var statusCode = res.statusCode || 500;
res.send(statusCode, {
code: statusCode,
View
6 lib/app/middleware/mojito-handler-static.js
@@ -204,7 +204,7 @@ function staticProvider() {
}
}
- return function (req, res, next) {
+ return function middlewareMojitoHandlerStatic(req, res, next) {
if (req.method !== 'GET' && req.method !== 'HEAD') {
next();
@@ -416,9 +416,7 @@ Export function to create the static handler.
until invalidated by a conditional GET request.
@return {Function} express middleware
**/
-module.exports = function (options) {
- return staticProvider(options);
-};
+module.exports = staticProvider;
// These will let us unit test
View
2  lib/app/middleware/mojito-handler-tunnel-parser.js
@@ -29,7 +29,7 @@ module.exports = function () {
staticPrefix,
tunnelPrefix;
- return function (req, res, next) {
+ return function middlewareMojitoHandlerTunnelParser(req, res, next) {
if (!appConfig && req.app && req.app.mojito) {
app = req.app;
View
7 lib/app/middleware/mojito-handler-tunnel-rpc.js
@@ -12,13 +12,15 @@
'use strict';
+var debug = require('debug')('mojito:middleware:tunnel-rpc'),
+ dispatcher = require('../../dispatcher');
/**
* Exports a middleware factory that can handle RPC tunnel requests.
*
* @return {Function} The handler.
*/
module.exports = function () {
- return function (req, res, next) {
+ return function middlewareMojitoHandlerTunnelRPC(req, res, next) {
var rpcReq = req._tunnel && req._tunnel.rpcReq,
command,
store;
@@ -66,7 +68,8 @@ module.exports = function () {
context: command.context
};
- return next();
+ debug('dispatching rpc tunnel request');
+ dispatcher.handleRequest(req, res, next);
}
);
};
View
2  lib/app/middleware/mojito-handler-tunnel-specs.js
@@ -18,7 +18,7 @@
* @return {Function} The handler.
*/
module.exports = function () {
- return function (req, res, next) {
+ return function middlewareMojitoHandlerTunnelSpecs(req, res, next) {
var specsReq = req._tunnel && req._tunnel.specsReq,
instance,
type,
View
2  lib/app/middleware/mojito-handler-tunnel-type.js
@@ -19,7 +19,7 @@
* @return {Function} The handler.
*/
module.exports = function () {
- return function (req, res, next) {
+ return function middlewareMojitoHandlerTunnelType(req, res, next) {
var typeReq = req._tunnel && req._tunnel.typeReq,
instance,
store;
View
2  lib/app/middleware/mojito-handler-tunnel.js
@@ -28,7 +28,7 @@ module.exports = function () {
specsMW = specs(),
typeMW = type();
- return function (req, res, next) {
+ return function middlewareMojitoHandlerTunnel(req, res, next) {
var middleware = [
parserMW,
rpcMW,
View
4 lib/mojito.js
@@ -37,7 +37,6 @@ var debug = require('debug')('mojito'),
libmiddleware = require('./middleware'),
librouter = require('./router'),
libstore = require('./store'),
- libtunnel = require('./tunnel'),
libextend = require('./util').extend,
Mojito;
@@ -65,7 +64,7 @@ Mojito extension for Express.
@param {express.application} app `express` application instance
@param {Object} options server options
@param {Object} options.context
-@uses *express, dispatcher, logger, middleware, router, store, tunnel
+@uses *express, dispatcher, logger, middleware, router, store
**/
function Mojito(app, options) {
@@ -243,7 +242,6 @@ Mojito.prototype._configureAppInstance = function (app, store, options, appConfi
module.exports = {
extend: extend,
middleware: libmiddleware.middleware,
- tunnelMiddleware: libtunnel.tunnelMiddleware,
dispatch: libdispatcher.dispatch,
dispatcher: libdispatcher.dispatch // alias for `dispatch`
};
View
40 lib/tunnel.js
@@ -1,40 +0,0 @@
-/**
- * Copyright (c) 2011-2013, Yahoo! Inc. All rights reserved.
- * Copyrights licensed under the New BSD License.
- * See the accompanying LICENSE file for terms.
- */
-
-/*jslint nomen:true, node:true*/
-
-/**
-Submodule used by mojito to configure tunnel middleware.
-
-Usage:
-
- app.post('/tunnel', mojito.tunnelMiddleware());
-
-Typically, applications will do this in their `app.js`.
-
-This is a **required** step in order for Mojito to accept tunnel requests
-from the client runtime.
-
-@module mojito
-@submodule tunnelMiddleware
-**/
-
-'use strict';
-
-var debug = require('debug')('mojito:tunnel'),
- dispatcher = require('./dispatcher');
-
-/**
- * Simply returns the dispatcher handler to process tunnel requests.
- */
-function registerTunnelRpc() {
- debug('installing tunnel handler');
- return dispatcher.handleRequest;
-}
-
-module.exports = {
- tunnelMiddleware: registerTunnelRpc
-};
View
1  tests/fixtures/badfiles/app.js
@@ -15,7 +15,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  tests/fixtures/gsg5-appConfig/app.js
@@ -14,7 +14,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  tests/fixtures/gsg5/app.js
@@ -15,7 +15,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  tests/fixtures/store/app.js
@@ -14,7 +14,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
2  tests/func/applications/frameworkapp/common/app.js
@@ -20,9 +20,7 @@ app.set('port', process.env.PORT || 8666);
libmojito.extend(app);
app.use(libmojito.middleware());
-
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
// "routeparamssimple": {
// "verbs": ["get"],
View
1  tests/func/applications/frameworkapp/configapp/app.js
@@ -21,7 +21,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
dispatcherMiddleware = libmojito.dispatch('{type}.{action}');
app.get('/:type/:action', dispatcherMiddleware);
View
2  tests/func/applications/frameworkapp/routing/app.js
@@ -21,8 +21,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
-
// "_any_mojit_particular_action": {
// "verbs": ["get"],
View
1  tests/func/applications/frameworkapp/serveronly/app.js
@@ -21,7 +21,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
// "default": {
// "verbs": ["get", "post", "put", "head", "delete"],
View
1  tests/func/applications/frameworkapp/usecase/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
// flickr5
app.get('/flickr5', function (req, res, next) {
View
1  tests/func/applications/frameworkapp/yaml-config/app.js
@@ -20,7 +20,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  tests/func/applications/performanceapp/part1/app.js
@@ -14,7 +14,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  tests/func/applications/performanceapp/part2/app.js
@@ -14,7 +14,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/@myMojit/index', libmojito.dispatch('@myMojit.index'));
View
1  tests/func/applications/performanceapp/part3/app.js
@@ -14,7 +14,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/:base/:action', libmojito.dispatch('{base}.{action}'));
View
1  tests/func/applications/performanceapp/part4/app.js
@@ -14,7 +14,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/:base/:action', libmojito.dispatch('{base}.{action}'));
View
1  tests/func/applications/performanceapp/part5/app.js
@@ -14,7 +14,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/:base/:action', libmojito.dispatch('{base}.{action}'));
View
1  tests/func/applications/performanceapp/part6/app.js
@@ -14,7 +14,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
View
1  tests/func/applications/performanceapp/part7/app.js
@@ -14,7 +14,6 @@ libmojito.extend(app);
app.use(libmojito.middleware());
app.mojito.attachRoutes();
-app.post('/tunnel', libmojito.tunnelMiddleware());
app.get('/status', function (req, res) {
res.send('200 OK');
Please sign in to comment.
Something went wrong with that request. Please try again.