New Javascript Client

The new YAWP! Javascript Client is ready to use! And it includes:

For more details, see the javascript client tutorial .

Node.js and React-Native

Now it is possible to write your API clients in Javascript and use them in different environments.

To use it in Web Apps, just add the regular script tag:

<script src="https://rawgit.com/feroult/yawp/yawp-1.6.5/yawp-client/lib/web/yawp.min.js"></script>

Now to use it in Node.js or React-Native:

npm install yawp --save

ES6 Promises

All YAWP! Javascript Client methods now return ES6 Promises, making it really easier to work with asynchronous calls.

Note: Some existing client code may break, because we have renamed some callback methods. It is really easy to fix doing the following changes:

Endpoint Extensions

The most exciting feature of the new YAWP! Javascript Client is that all yawp client methods can now be extended by subclassing the base yawp function for a given endpoint. And this can be done either with the ES6 class syntax or with ES5 prototypes.

For instance, to create a Person endpoint extension that is linked to the /people endpoint:

class Person extends yawp('/people') {
    static inactive() {
        return this.where('status', '=', 'INACTIVE');
    }

    activate() {
        return this.put('active');
    }
}