Skip to content

Commit

Permalink
Fixed conflict with app.js.
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe Catera committed Feb 13, 2014
2 parents d5be22f + 6661107 commit 9a1e52e
Show file tree
Hide file tree
Showing 134 changed files with 1,701 additions and 699 deletions.
19 changes: 11 additions & 8 deletions HISTORY_next.md
Expand Up @@ -13,7 +13,7 @@ unnecessary conflict on every merge.
This is a document in progress as more work is being done on #next.
```

This release introduces a set of new APIs and concepts.
This release introduces a set of new APIs and concepts.

Please refer to some of the examples apps under the `examples/` folder to get
an overview of what have changed.
Expand All @@ -24,19 +24,19 @@ Deprecations, Removals
* Mojito no longer supports `index.js` and `server.js` to start up the server.
Applications will instead instantiate Mojito as follows:

var mojito = require('mojito'),
var libmojito = require('mojito'),
express = require('express'),
app;

app = express();
// "app.mojito" refers to the Mojito instance as part of the Express app
// "mojito" refers to the Mojito module that exposes helpers - see below
libmojito.extend(app, { /* context */ });
// at this point, access mojito instance via `app.mojito`

* Middleware configuration is no longer supported via `application.json`.
Applications can register their middleware using the Express API. To enable
Mojito middleware, use the following:

app.use(mojito.middleware());
app.use(libmojito.middleware());

* `routes.json` configuration is no longer loaded by default. To tell Mojito to
do so, use the following:
Expand All @@ -53,15 +53,18 @@ Deprecations, Removals
control on how best to handle this error.

* The `ac.url.find()` and `Y.mojito.RouteMaker.find()` methods are now
deprecated and have been removed. If applications needs to query the route
object, either use the `name` or `path` by leveraging `express-map`.
deprecated and will be removed in a future version.

Applications that rely on this API should familiaze with the `express-map`
package by querying the route object by `name` or `path`.

Features
--------

* To register Mojito routes programmatically instead of using `routes.json`:

```
// app.js
app.get('/foo', mojito.dispatch('foo.index'));
app.map('/foo', 'foo');
app.map('/foo', 'get#foo.index');
Expand All @@ -71,7 +74,7 @@ app.map('/foo', 'get#foo.index');
dispatcher, setup 2 additional "aliases". The second alias is the HTTP method
concatenated with the `call` value using the `#` delimeter.

This is equivalent to doing this in `routes.json`:
This is equivalent to doing this in `routes.json` in "pre-next":

```
[{
Expand Down
8 changes: 5 additions & 3 deletions examples/developer-guide/adding_view_engines/app.js
Expand Up @@ -11,14 +11,16 @@

var debug = require('debug')('app'),
express = require('express'),
mojito = require('../../../'),
libmojito = require('../../../'),
app;

app = express();
app.set('port', process.env.PORT || 8666);
libmojito.extend(app);

app.use(mojito.middleware());
app.use(libmojito.middleware());
app.mojito.attachRoutes();
app.post('/tunnel', mojito.tunnelMiddleware());
app.post('/tunnel', libmojito.tunnelMiddleware());

app.get('/status', function (req, res) {
res.send('200 OK');
Expand Down
8 changes: 5 additions & 3 deletions examples/developer-guide/binding_events/app.js
Expand Up @@ -11,14 +11,16 @@

var debug = require('debug')('app'),
express = require('express'),
mojito = require('../../../'),
libmojito = require('../../../'),
app;

app = express();
app.set('port', process.env.PORT || 8666);
libmojito.extend(app);

app.use(mojito.middleware());
app.use(libmojito.middleware());
app.mojito.attachRoutes();
app.post('/tunnel', mojito.tunnelMiddleware());
app.post('/tunnel', libmojito.tunnelMiddleware());

app.get('/status', function (req, res) {
res.send('200 OK');
Expand Down
8 changes: 5 additions & 3 deletions examples/developer-guide/configure_routing/app.js
Expand Up @@ -11,14 +11,16 @@

var debug = require('debug')('app'),
express = require('express'),
mojito = require('../../../'),
libmojito = require('../../../'),
app;

app = express();
app.set('port', process.env.PORT || 8666);
libmojito.extend(app);

app.use(mojito.middleware());
app.use(libmojito.middleware());
app.mojito.attachRoutes();
app.post('/tunnel', mojito.tunnelMiddleware());
app.post('/tunnel', libmojito.tunnelMiddleware());

app.get('/status', function (req, res) {
res.send('200 OK');
Expand Down
Expand Up @@ -11,13 +11,15 @@

var debug = require('debug')('app'),
express = require('express'),
mojito = require('../../../../'),
libmojito = require('../../../../'),
app;

app = express();
app.set('port', process.env.PORT || 8666);
libmojito.extend(app);

app.use(mojito.middleware());
app.get('/', mojito.dispatch('@Github.index'));
app.use(libmojito.middleware());
app.get('/', libmojito.dispatch('@Github.index'));


app.listen(app.get('port'), function () {
Expand Down
8 changes: 5 additions & 3 deletions examples/developer-guide/dashboard/02_mojits/app.js
Expand Up @@ -11,14 +11,16 @@

var debug = require('debug')('app'),
express = require('express'),
mojito = require('../../../../'),
libmojito = require('../../../../'),
app;

app = express();
app.set('port', process.env.PORT || 8666);
libmojito.extend(app);

app.use(mojito.middleware());
app.use(libmojito.middleware());
app.mojito.attachRoutes();
app.post('/tunnel', mojito.tunnelMiddleware());
app.post('/tunnel', libmojito.tunnelMiddleware());

app.get('/status', function (req, res) {
res.send('200 OK');
Expand Down
8 changes: 5 additions & 3 deletions examples/developer-guide/dashboard/03_frame_mojits/app.js
Expand Up @@ -11,14 +11,16 @@

var debug = require('debug')('app'),
express = require('express'),
mojito = require('../../../../'),
libmojito = require('../../../../'),
app;

app = express();
app.set('port', process.env.PORT || 8666);
libmojito.extend(app);

app.use(mojito.middleware());
app.use(libmojito.middleware());
app.mojito.attachRoutes();
app.post('/tunnel', mojito.tunnelMiddleware());
app.post('/tunnel', libmojito.tunnelMiddleware());

app.get('/status', function (req, res) {
res.send('200 OK');
Expand Down
8 changes: 5 additions & 3 deletions examples/developer-guide/dashboard/04_composite_mojits/app.js
Expand Up @@ -11,14 +11,16 @@

var debug = require('debug')('app'),
express = require('express'),
mojito = require('../../../../'),
libmojito = require('../../../../'),
app;

app = express();
app.set('port', process.env.PORT || 8666);
libmojito.extend(app);

app.use(mojito.middleware());
app.use(libmojito.middleware());
app.mojito.attachRoutes();
app.post('/tunnel', mojito.tunnelMiddleware());
app.post('/tunnel', libmojito.tunnelMiddleware());

app.get('/status', function (req, res) {
res.send('200 OK');
Expand Down
8 changes: 5 additions & 3 deletions examples/developer-guide/dashboard/05_getting_data/app.js
Expand Up @@ -11,14 +11,16 @@

var debug = require('debug')('app'),
express = require('express'),
mojito = require('../../../../'),
libmojito = require('../../../../'),
app;

app = express();
app.set('port', process.env.PORT || 8666);
libmojito.extend(app);

app.use(mojito.middleware());
app.use(libmojito.middleware());
app.mojito.attachRoutes();
app.post('/tunnel', mojito.tunnelMiddleware());
app.post('/tunnel', libmojito.tunnelMiddleware());

app.get('/status', function (req, res) {
res.send('200 OK');
Expand Down
8 changes: 5 additions & 3 deletions examples/developer-guide/dashboard/06_testing/app.js
Expand Up @@ -11,14 +11,16 @@

var debug = require('debug')('app'),
express = require('express'),
mojito = require('../../../../'),
libmojito = require('../../../../'),
app;

app = express();
app.set('port', process.env.PORT || 8666);
libmojito.extend(app);

app.use(mojito.middleware());
app.use(libmojito.middleware());
app.mojito.attachRoutes();
app.post('/tunnel', mojito.tunnelMiddleware());
app.post('/tunnel', libmojito.tunnelMiddleware());

app.get('/status', function (req, res) {
res.send('200 OK');
Expand Down
8 changes: 5 additions & 3 deletions examples/developer-guide/dashboard/07_binders/app.js
Expand Up @@ -11,14 +11,16 @@

var debug = require('debug')('app'),
express = require('express'),
mojito = require('../../../../'),
libmojito = require('../../../../'),
app;

app = express();
app.set('port', process.env.PORT || 8666);
libmojito.extend(app);

app.use(mojito.middleware());
app.use(libmojito.middleware());
app.mojito.attachRoutes();
app.post('/tunnel', mojito.tunnelMiddleware());
app.post('/tunnel', libmojito.tunnelMiddleware());

app.get('/status', function (req, res) {
res.send('200 OK');
Expand Down
10 changes: 6 additions & 4 deletions examples/developer-guide/dashboard/08_adv_config/app.js
Expand Up @@ -11,22 +11,24 @@

var debug = require('debug')('app'),
express = require('express'),
mojito = require('../../../../'),
libmojito = require('../../../../'),
app;

app = express();
app.set('port', process.env.PORT || 8666);
libmojito.extend(app);

app.use(mojito.middleware());
app.use(libmojito.middleware());

app.get('/', function (req, res, next) {
req.params.view_type = "yui";
next();
}, mojito.dispatch('tribframe.index'));
}, libmojito.dispatch('tribframe.index'));

app.get('/mojito', function (req, res, next) {
req.params.view_type = "mojito";
next();
}, mojito.dispatch('tribframe.index'));
}, libmojito.dispatch('tribframe.index'));

app.listen(app.get('port'), function () {
debug('Server listening on port ' + app.get('port') + ' ' +
Expand Down
10 changes: 6 additions & 4 deletions examples/developer-guide/dashboard/09_hb_templates/app.js
Expand Up @@ -11,22 +11,24 @@

var debug = require('debug')('app'),
express = require('express'),
mojito = require('../../../../'),
libmojito = require('../../../../'),
app;

app = express();
app.set('port', process.env.PORT || 8666);
libmojito.extend(app);

app.use(mojito.middleware());
app.use(libmojito.middleware());

app.get('/', function (req, res, next) {
req.params.view_type = "yui";
next();
}, mojito.dispatch('tribframe.index'));
}, libmojito.dispatch('tribframe.index'));

app.get('/mojito', function (req, res, next) {
req.params.view_type = "mojito";
next();
}, mojito.dispatch('tribframe.index'));
}, libmojito.dispatch('tribframe.index'));

app.listen(app.get('port'), function () {
debug('Server listening on port ' + app.get('port') + ' ' +
Expand Down
10 changes: 6 additions & 4 deletions examples/developer-guide/dashboard/10_localization/app.js
Expand Up @@ -11,22 +11,24 @@

var debug = require('debug')('app'),
express = require('express'),
mojito = require('../../../../'),
libmojito = require('../../../../'),
app;

app = express();
app.set('port', process.env.PORT || 8666);
libmojito.extend(app);

app.use(mojito.middleware());
app.use(libmojito.middleware());

app.get('/', function (req, res, next) {
req.params.view_type = "yui";
next();
}, mojito.dispatch('tribframe.index'));
}, libmojito.dispatch('tribframe.index'));

app.get('/mojito', function (req, res, next) {
req.params.view_type = "mojito";
next();
}, mojito.dispatch('tribframe.index'));
}, libmojito.dispatch('tribframe.index'));

app.listen(app.get('port'), function () {
debug('Server listening on port ' + app.get('port') + ' ' +
Expand Down
16 changes: 9 additions & 7 deletions examples/developer-guide/dashboard/trib/app.js
Expand Up @@ -11,26 +11,28 @@

var debug = require('debug')('app'),
express = require('express'),
mojito = require('../../../../'),
libmojito = require('../../../../'),
app;

app = express();
app.set('port', process.env.PORT || 8666);
libmojito.extend(app);

app.use(mojito.middleware());
app.use(libmojito.middleware());

app.get('/', function (req, res, next) {
req.params.view_type = "yui";
next();
}, mojito.dispatch('tribframe.index'));
}, libmojito.dispatch('tribframe.index'));

app.get('/mojito', function (req, res, next) {
req.params.view_type = "mojito";
next();
}, mojito.dispatch('tribframe.index'));
}, libmojito.dispatch('tribframe.index'));

app.get('/header', mojito.dispatch('header.index'));
app.get('/body', mojito.dispatch('body.index'));
app.get('/footer', mojito.dispatch('footer.index'));
app.get('/header', libmojito.dispatch('header.index'));
app.get('/body', libmojito.dispatch('body.index'));
app.get('/footer', libmojito.dispatch('footer.index'));

app.listen(app.get('port'), function () {
debug('Server listening on port ' + app.get('port') + ' ' +
Expand Down

0 comments on commit 9a1e52e

Please sign in to comment.