What do folks use to generate their web api

20 views
Skip to first unread message

Mark Lester

unread,
Apr 12, 2016, 11:51:28 AM4/12/16
to Sequelize
The whole point of having a database is so you can put bits of it on a web page, that's why we invented web pages.

I use epilogue. I like it, Its well written and the support is active and helpful.
I made a loadModels thing for Sequelize, You stick model files in by default a models directory that look like this

module.exports={
attributes
:{
        universalId
:{unique:true},
        value
: {},
   
},
relations
:[{
        type
:'belongsTo',
        relatedModel
:'Element'
   
},{
        type
:'belongsTo',
        relatedModel
:'Contract'
   
},{
        type
:'belongsTo',
        relatedModel
:'Party' // proposer
   
}
],
hooks
:{
bla bla

 and in turn souped up epilogue so that it will do it's stuff for every model that isnt contracted out (I have an options block with magic powers in the above)
and then also got it to literally return
sequelize.models.toJSON(),filter)

from /api.
That allows me to not only establish a handy dictionary of backbone models, but cos I have the relational info too I can build a default hierarchical store of collections, using a "primary parent", the first listed, with cursors for the current model in any given collection to use as a parent for any child collections. i.e a data browser in effect.
This is turning out to be a really useful data structure.

Anyhow. What do other people use if they arent using epilogue to do al this stuff. i.e why did it break and humble me was the first to notice.


Mark Lester

unread,
Apr 12, 2016, 11:58:50 AM4/12/16
to Sequelize
that should of course read
 JSON.stringify(sequelize.models,filter)

though actually I am adding pseudo models and of course the filter function is just a hack
Reply all
Reply to author
Forward
0 new messages