Question

I've been using nodeJS + expressJS for several years now developing a custom Application Platform for our organization. Our central framework provides a common set of services (authentication, language, administration, etc...) for any installed Modules/Applications under it.

I would like to switch our framework out with compoundJS. However I'm not familiar with the design constraints imposed by it (and Rails apps in general) and can't seem to figure out how to accomplish what I'm after.

  • I would like to only have a single server instance running: all requests first process through our common authentication checking. Then are passed on to an application's controllers.

  • I would also like to have each application separated out: preferably under a separate site/applications/ directory. Each of these applications could be designed using compoundJS normally. And I would like to install them like:

    cd site/applications
    npm install site-hr
    npm install site-finance
    npm install site-payroll
    

    this would then have all the routes from /hr, /finance, /payroll operational.

How do I accomplish this?

Is there a way to get compoundJS to search the nonstandard /applications/* folders for models/controllers/views and load them while keeping the central /site configurations?

Or is there a better way?

Was it helpful?

Solution

Sorry for the late answer, but I needed something similar: I needed to put together tool applications in a portal.

I found a way to include child applications in a parent's Compound application as node modules. I wrote a guide on how to do it and sent a pull request to add it in the advanced folder of CompoundJS' guides. It is also available here. It requires a bit of work, but it works fine with 4 applications for us.

Hope it can help.

OTHER TIPS

It's simple. Just use app.use in config/environment.js to map your sub-apps:

var mod = require('your-compound-module');
app.use('/subroot', mod());

When you visit /subroot/any-path, then it will be handled by /anypath route of your sub-app. Note, that you don't need any additional work on path helpers, as they will start with '/subroot' automatically (handled on compound side).

This is a good point, but we haven't seen any implementation yet. May be years later there would be some.

Using a proxy layer in front of the instances would be a general method, usually with Nginx, Vanish Cache etc. For the bleeding edge techs, I've heard Phusion Passenger has implemented Node.js support, but I haven't successfully tested yet. If you are familiar with Ruby, it would be a good try.

If you really want to construct a big project with many modules, you can try out some industrialized frameworks for instance Architect for Cloud9 IDE project.

For authentication, I think it's necessary to use independent methods in each application, but they can share with one user database.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top