mikec / kalamata

Extensible REST API for Express + Bookshelf.js
MIT License
41 stars 12 forks source link

Hooks for relations #13

Open hdon opened 6 years ago

hdon commented 6 years ago

If I have something like the following:

const Album = bookshelf.Model.extend({
  songs: function() { return this.hasMany(Song) }
})

const Song = bookshelf.Model.extend({
  album: function() { return this.belongsTo(Song) }
})

api.expose(Album);

Is there a way to hook requests like GET /albums/1/songs?