Reputation: 13095
I am using Sequelize as my server side ORM. Is there a recommended approach towards sharing the Model code (especially the validations) with my client application ?
Please don't recommend solutions which require me to move to a NoSQL database. Currently that is not an option for me. While I really Sequelize as an ORM, I am willing to move onto some other model implementation if it is beneficial.
Upvotes: 3
Views: 260
Reputation: 14846
Persistencejs, but it doesn't appear to be as well maintained as Sequelize:
https://github.com/zefhemel/persistencejs
Upvotes: 1
Reputation: 13095
At present there does not seem to be an end to end solution ie. a model library which you could just require in either browser or server and define your models - where methods like save, update would be polymorphic requiring the developer to just extend standard model classes and use them on either client or server.
However, for people looking for a similar solution - I recommend using JSON schema validators, which are quite hassle free and provide a simple means to share your validation logic between client and server.
Upvotes: 0