A
A
agentx0012013-10-28 21:36:05
JavaScript
agentx001, 2013-10-28 21:36:05

Recommend a framework for node?

There is an idea to write a browser for mobile phones, since I know JS and had experience with node, then I think to do it on the node accordingly. But to be honest, I can’t decide on a framework at all - there are too many of them ... Tell me, please. I don't need much, MVC and page rendering on the server. I liked this brand new impress, but I'm not trying to use a self-made product that can collapse at any moment and does not even have documentation ...
PS: In general, I would like to hear all the suggestions about writing mobile text games;)

Answer the question

In order to leave comments, you need to log in

7 answer(s)
T
Timur Shemsedinov, 2013-10-30
@MarcusAurelius

As the main author of Impress , I will not advise him, but I will say a few words so that there are no unnecessary expectations from the framework. And I will give advice that will help you write a good project on any framework.
Answers:
agentx001 :

I don't need much, MVC and page rendering on the server.

What is MVC there is no common opinion, so it happens that everyone will understand it differently, then write something horrible, and call it MVC. So, Impress is not MVC, if you understand MVC as a separate writing of controllers, models and views. We will not discuss what MVC is, this is a very worn out term, and we will get confused in the conjectures that are heaped around it. I'd rather say what to expect from the framework: Impress, in itself, is a universal controller, it is just written in order not to write controllers. It has a view implementation - these are renderers, one of the renderers is a template engine (with it you can render not only HTML, but also CSV, CSS, TXT and anything), but there is also a renderer for JSON, it is quite simple, you can add other renderers, for other data formats, if templating is not suitable, for example, for binary data. Impress also has an implementation of the application logic - which is divided into three parts: (a) the logic of the domain data model, (b) the presentation logic, i.e. rendering logic, (in) the logic of general-purpose libraries not related to the subject area. The domain logic is the business logic of the application, for example: an algorithm for calculating the route of cargo delivery, for a cargo cracking system. Rendering logic is when you need to generate data for rendering using imperative code (i.e. using normal algorithmic programming with conditions, loops and calls), and not just using declarative templates and declarative conditions in them. The logic of general purpose libraries is all universal tasks that can be reused in other projects, for example, generating a DOCX document, data validation, reading the number of frames from an animated GIF, etc. All these three types of logic (code) are much more important to separate from each other than the model from the presentation. But separating the view from the view logic is generally a terrible heresy, which many MVC frameworks fall into.
agentx001 :
I liked this brand new impress, but I don’t aspire to use a self-made product that can collapse at any moment and doesn’t even have documentation ...

In addition to self-written ones, what else do you know? Maybe there are some automatically written or generated ones? There are articles, there are examples, part of the API is already documented, for example, here: impress/wiki . There will be screencasts soon, I already talked about this. And there is very little code in Impress, the core weighs 43kb. The code is neatly written, it can be read in 5 days if you read 5 pages a night. Examples of a finished web application (admin panel for MySQL and MongoDB databases) are given along with the system and are described here : http://habrahabr.ru/post/192302/rozhik
:
Regarding criticism of impress, I would still choose another one. A very strange architecture, if it survives, it will obviously change not only half of the api, but also the principles of file arrangement.

The framework did not appear from scratch, the file structures, like the API, were created as ported to the node, the developments of my team over the past 15 years on Delphi, C#, PHP and JavaScript. The directory structure and API will grow, but not radically altered, I have already found a golden mean for myself in the architecture of systems. Here's what will change in the coming months - this is the format of the config, i.e. Impress is not just a framework, it is an application server, and it can serve several applications at once (on different domains). To do this, the config will be divided into basic settings and a separate configuration, for each application. But the config is not a fork, splitting it into several files is not a problem, moreover, the structure of the config will not change much.
Adviсe:
1. If you have a website, then render the templates on the server, but if you have an application, then make one page (well, or several main pages), and make an API on AJAX and JSON on the server. Send data to a client application, whether it's a web or mobile app for iOS or Android, or a windowed app, in any language. It is much more versatile and more convenient for integration and support.
2. Use RAM, do not climb into the database all the time. Node is a great opportunity to write fast applications, and not even because it is non-blocking, over the past year I have learned that the correct use of memory is much faster, you don’t even need to do real-time I / O operations, that’s all they can be delayed (lazy, lazy). Instead, expand data into application memory, build hashes, objects, arrays. There is no need to be afraid that the node is running in several processes, and requests from one user can come to different processes and find different data structures there. This can be solved by "sticking" clients by IP address or by Cookie using a load balancer to a separate node process. Impress has such a balancer built in, you can use nginx or the services of your data center, for large projects you can and should involve hardware balancers. You can also communicate between different processes through ZeroMQ, TCP, HTTP, IPC, and anything else. Thus, the data of different processes, depending on what kind of data it is, can either be duplicated in memory (cached if it is shared data) or divided into “sticky” sessions or synchronized with each other through interprocess communication.
3. Don't be enamored with technology, take as little of it as possible, and dig deep rather than high. For a node, a very large variety of everything is now written, and there is some general tendency to connect a hundred modules to the project that do completely trifling things, and those modules pull some other dependencies along with them, and then it spreads and becomes completely uncontrollable. Think 100 times before writing require, and if there are several alternatives, then spend a little time to feel their code, test performance and convenience, this will save a lot of time later.

E
evgabd, 2013-10-28
@evgabd

Maybe this one will work: expressjs.com

R
rozhik, 2013-10-28
@rozhik

I will not recommend any particular framework (sorry), but I wanted to note that if you liked it, and satisfies it in its current state, then take it. Develop with the authors (especially since it is very simple). In the end, no one canceled the fork. All products were homemade.
Regarding criticism of impress, I would still choose another one. A very strange architecture, if it survives, it will obviously change not only half of the api, but also the principles of file arrangement.
P. S.: Вообще хотелось бы выслушать все предложения по поводу написания мобильных текстовых игр ;)
I suggest not to write them (if you want to earn money).

W
Weageoo, 2013-10-28
@Weageoo

Rumor has it that despite the existence of all kinds of Sails.js, Geddy.js, Tower.js and so on. people mostly use Express.js (and express.js itself is the basis of many frameworks). I myself am just a beginner node writer, but I scanned the situation just recently, and my plan is as follows:
- I study a bare node;
— learning express.js;
- after I will make a decision - is it worth taking c.-l. framework with more abstraction.
Then - with all sorts of Sails.js, Geddy.js, Tower.js, there may be problems in terms of cross-platform, inconvenience (if you use Windows for development), then there are also problems in cloud IDEs like c9.io. So I propose to follow my simple plan - if no one offers a better plan.

P
pomeo, 2013-10-28
@pomeo

Take express and do not suffer. I sometimes look at derbyjs.com , but I would not take it and use it anywhere.

A
agentx001, 2013-10-29
@agentx001

In order not to produce - which modules for the express should be paid attention to? Template engine, ORM, there ...

A
Alexey Yaroshevich, 2015-04-05
@qfox

You can also try https://github.com/2gis/slot
They have specific BEM, isomorphism, and all that.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question