how to manage functionality and ui/templates using nodejs

57 views
Skip to first unread message

MC

unread,
Jun 19, 2014, 2:27:47 PM6/19/14
to nod...@googlegroups.com
Hello,
I'm working on a project that provides multiple services/views as part of one online experience. For example the system provides a list of products (catalog) as one service, and a shopping cart as another. Both can be rendered for web/desktop and web/mobile. In case of mobile experience some components visible on the web/desktop site can be removed.
Currently the company is developing a large monolithic application which is supposed to handle everything. The thing is that system is non-standard (house built), buggy and very complex. At the moment I'm spending more time on trying to integrate with it than on adding new features.

I was wondering if it would be possible to share both functionality and ui (e.g. dust templates) as nodejs modules? So that final application (e.g. shopping cart for web/mobile) can include the modules needed and only assemble them in app.js with some modification?

Current project structure for nodejs keeps client/browser data in 'public' folder, and server/service code ends up in views/libs/modules, etc. I experimented with storing dust templates inside modules and it looks like it can be done, but haven't tried it with client side js.

I'd like to see if anyone has encountered similar issues when integrating vertically separated nodejs applications into one online experience. If so I'd appreciate it if you could share your thoughts/findings on the subject. I'd like to find a more modular approach, something more natural for nodejs, as a replacement for the monolithic app I'm working with today.
Thanks,

M


Darren

unread,
Jun 20, 2014, 12:01:46 AM6/20/14
to nod...@googlegroups.com
MC, not sure if you're using Express, but "mounted apps" are an interesting way to compose things in that framework. They allow standalone applications to be mounted at different routes within a parent application. Check the express/examples/ directory if you want to see how it works. For separating mobile / desktop ui components, if you're rendering templates client-side, the static resources for client-side rendering are usually served out of a high-speed cache for production deployments. If you're rendering pages on the server side, node modules for EJS, Jade, Dust et al are all there. Good luck with the project!

Alexey Petrushin

unread,
Jun 20, 2014, 2:12:15 AM6/20/14
to nod...@googlegroups.com
We use browserify to assemble our application. It also handles things like pre-compiling Templates, CoffeeScript etc.

In the end the application assembled very much like any server-side node.js app.
Reply all
Reply to author
Forward
0 new messages