M
M
makerkz2014-03-07 19:07:45
JavaScript
makerkz, 2014-03-07 19:07:45

How to implement a modular system in node.js?

Good day.
There is an empty node.js application. It is necessary to implement a similar system in it - users, news, articles, settings, calendar, etc. With the implementation of all this, there should not be any special problems. The whole problem is in linking these components and presenting them as modules. Imagine the following situation:
A user management system has been written.
It is necessary to create a news system, write a separate news module (category, title, creation date, news text), which is subsequently connected to the system (the user can write news on his own behalf).
A calendar with events is created (the user can create his own events in the calendar, watch the events of other users), again as a separate module.
It turns out a kind of CMS system, which is expanded by adding certain modules. I'm afraid to even cite Joomla, Wordpress, ModX as an example - I think you yourself know this). Could you suggest tutorials or something similar to understand how this should be implemented? Communication between all these components to painlessly add new modules.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
rumkin, 2014-03-07
@makerkz

In nodejs, there is no mvc in the implementation of other languages, or rather it is, but it looks different. And MVC frameworks are not very popular, although there are attempts to implement: sailsjs.org and derbyjs.com
I advise you to study the principle of connect or express, where you string handlers on a request, like on a thread, the first triggered handler should: return the result and stop execution, or transfer execution to the next handler, possibly adding new properties to the request object. The binding of system elements occurs in many ways, but is usually done through the extension of the request or response object. This allows you to encapsulate modules, making them less dependent on the system as a whole.

V
Vitaly Makeev, 2014-10-22
@wmakeev

I will give a number of approaches that helped me implement a modular system on Node.js
- Excellent article about the modular approach in writing applications
- A framework (from the author of the article) that implements the described approach for building web applications - AuraJS
- Another more general implementation - scaleApp
- You can see soma .js ( article )

A
Alexey Dugnist, 2018-06-27
@Dugnist

For modular architecture, I suggest taking a look:
https://github.com/Dugnist/jsberry

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question