Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

06. Mojito v0.9: Setting Base Contexts

Albert Jimenez edited this page Mar 24, 2014 · 4 revisions

In the previous versions of Mojito, you set the base context with the Mojito command-line tool using the option --context. In Mojito v0.9, you start applications directly with app.js, so you need to alter the app.js so that your application can be extended and accept context configurations, such as the runtime and the environment.

To extend your applications, you create an instance of your Mojito applications and use the extend method:

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

libmojito.extend(app, {
    // Pass your context object here.
});

For example, to have your applications start in the staging environment and use the server runtime, you would pass the context object below to the extend method:

libmojito.extend(app, {
    context: {
        runtime: 'server',
        environment: 'staging'
    }
});
Clone this wiki locally