Karnith
Karnith

Reputation: 33

Add views, controllers and models without restarting Sails

For starters, let me say I really like Sails framework with it's blueprint routes and restful api.

So, this is my question and scenario to get a better understanding of where the limits of Sails and NodeJS are.

Scenario: I would like to build an app that is modular in design. The core app will have a set amount of features built into it (media catalog/library with metadata tagging, import and control of that metadata) which would be open source. I then would have modules (plugins) for sale that would add additional features to the app like media streaming to web a interface, streaming of external sources like youtube, etc.

Question/s:

  1. Is it possible to have these plugins uploaded to the app and configurable without the need to restart the Sails application?
  2. If not, is this a limitation of Sails or NodeJS?

Although it would be easy to create a watcher for the directories and restart the server, I am hesitant on doing this. If the app was in production, restarting the app would cause all sockets and sessions to be terminated which would cause a disruption to any users currently watching media being streamed.

The goal, I guess, is to have a plugin upload service (kind of like saas) that would take the plugin package and move the plugin files (views, controllers and models) to the various sections of the application while still making use of the blueprints functionality of Sails for route generation without terminating any current sessions/sockets for a good user experience.

Am I going about this the wrong way?

Thanks

Upvotes: 1

Views: 228

Answers (2)

Travis Webb
Travis Webb

Reputation: 15018

This is now possible with sails-autoreload

Upvotes: 1

mdunisch
mdunisch

Reputation: 3697

Why you dont upload all Plugins and use a Policy of Sails?

You can write the accable plugins in a database and if you want to change, simple update the database-record.

In your Sails-Policy you can select the database on each request.

Upvotes: 0

Related Questions