Search code examples
node.jsrestexpressroutesrapid-prototyping

Any packages for creating a dynamic restful resource API in an express server?


For example, think of something like Firebase.

  • If a user GETs from /, it will respond with the data of the entire collection (preferably automatically handle pagination if there is a lot of data)
  • If a user GETs from /some/.../endpoint, it will automatically resolve the resource at that point, no matter how deep you go, without any configuration necessary
  • If a user PUTs from /some/.../endpoint, it will automatically deposit the data at that endpoint, (creating the necessary storage structures / collections / objects for the underlying data provider)

I don't want something like mongoose, because I don't want to explicitly declare my own models. I want to keep the specifics of the application on the front-end as much as possible, so the server can have minimal configuration.

Is there any node.js library that takes care of this for you? If not, I'm sure lots of people have experience in creating dynamic REST endpoints like this. What insight can you provide?


Solution

  • It doesn't 100% answer what you are asking for, but look at the booster library I wrote and have been building over the years. http://github.com/deitch/booster

    It has automatic generation of endpoints based on the resource you configure. You can set the model fields, validation, post processors, filters, etc. etc. (and associations/relationships are in progress). Look at the README on the github home page for its features and examples.