Reputation: 1266
I have a rails app which is the REST api. Part of the models i have are javascript scripts that the users are able to upload.
I want to create a background worker task where i can make a network request and execute the javascript on the result of the network request server side and then save it to the database.
Now i have been told to consider using a Rails front end api and then use a NodeJS server for being the workers and executing javascript.
My main concern is developing a cross platform schema with nodejs orm and rails orm.
So my question is twofold is there a way of developing the database schema so it is in sync across both the Node JS server and the Rails server. Else is there a way of executing the javascript on the rails server?
Upvotes: 1
Views: 1068
Reputation: 2268
You can use https://github.com/balderdashy/waterline or https://github.com/sequelize/sequelize or https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino/Shell to access same database as Rails app from Node.js app but make sure that you are only reading from database using Node.js not writing
Upvotes: 2