The whole networking communication is handled by the Networking module.

To use it, you have to refer by the app.networking instance. The app object is available in routing, views and other parts of your application.

The app.networking object by default uses HTTP connection.

AJAX request

app.networking provides methods for basic REST requests:

Example for routing:

// models/user.client.js
module.exports = (app) => {
    return {
        getUsers(callback) {
            app.networking.get("/users", callback);

Example for views:

    this.onRender(function () {"/users", (err, resp) => {});

If you need to specify more options (e.g. expected type, headers, cookies) use createRequest() method.

For local requests use createLocalRequest() method.

Custom headers


This HTTP header may be a text, json or html.

It's defined by the Networking.Request::type attribute.

App.Route is using this property to return data in the needed format.