vigetlabs / gangway

A client-side API abstraction layer
MIT License
13 stars 1 forks source link

Fix awkward `route` API #32

Closed nhunzaker closed 8 years ago

nhunzaker commented 8 years ago

Now that we have namespace and resource APIs, the two-tier style route API is causing some awkwardness. Instead of:

API.route({
    users: {
        create: {..},
        read: {..},
        update: {..},
        destroy: {..}
    }
})

We should instead recommend:

API.namespace('users').route({
    create: {..},
    read: {..},
    update: {..},
    destroy: {..}
})

The work here is pretty minimal, individual routes are created using src/endpoint.js. src/route.js just sits on top of that. We'd simply have to cut the middleman (route.js), and update the docs.

nhunzaker commented 8 years ago

Done.