What technology stack (modules, frameworks) is better for the first node.js project to learn about node and make a good product?

A year ago, I took a few small steps in node. Even then there were a large number of modules and frameworks. Now I want to take a deeper look at the node environment and launch a web project (a service for web and mobile applications). I understand that a lot depends on what application you are writing, but there is always some kind of base in it.

At this point I would like to know:

  • Is it better to start from scratch or take some kind of framework (in your opinion)?
  • Which modules are of utmost importance? What modules should I pay attention to first of all?
  • What databases and modules do you prefer?
  • I heard that you can write in coffeescript for node. What should I do for this? Or maybe it is better to use javascript?
  • About some useful books and tutorials about node in action.

All these questions are quite broad, but the answers will be very useful for all beginners.

Thanks)

+4
source share
4 answers

I will try to answer your question from the point of view of the one who tried to enter Node.js by parallel development of an identical project with various combinations of "modern" modules.

  • The complexity of your project dictates the approach as usual. If you want to explore the full spectrum of Node subtleties, you can create from scratch and simply use the appropriate libraries (for example, abstraction of the connection level and database, such as a cradle or mongoose, in answer 2.), when you have a need for them .

    If you want to have a code base from which you can find workable solutions, you should go for the Express framework (built on the connection), since it is apparently the most common among node developers. Many training sites provide easy-to-use examples that include this structure . The Bogart module will do the same, but it is not so widely known.

  • Besides Express, you might want to look into the Templating System for HTML output. I would suggest Jade . I will explain why in answer 4. The alternative may be Mustache or AJS.

    Then you should check cradle or mongoose , as these modules will be needed for convenient access to the database . Now that the main functions and databases are covered, you might want to explore the LESS or SASS modules for CSS magic.

    Authentication can be handled by everyauth , it delivers twitter, facebook and many other oauth features.

  • I think I already examined the modules in 2. Now, now to the DB question. I enjoyed working with MongoDB , and you can easily handle this and find a lot of documentation and best practices on the Internet. I myself found CouchDB much more interesting as it provides fantastic API-based access, and that’s the phrase “Relax.” - but in fact it is not so important. As long as you understand the NoSQL approach that controls the mongo and couch, you can use either of them. I highly recommend avoiding traditional SQL-based databases , as JSON- formatted output from NoSQL database systems is easily integrated into Node.js. JavaScript

  • I developed it with JS and Coffee, and I can tell you one thing: with a cup of the latter, it will be much easier for you to launch your projects. Indentation is programmed based on the Jade Templating system, which is also sensitive to deposition. Having the same thinking for server code and view code (and CSS, even indentation is only for your convenience), makes development at the same time much easier. I have yet to find a problem from JS that cannot be solved with the much more beautiful CoffeeScript expression.

  • Follow the node project on github, follow the project Express / Connect / cradle / Jade / mongoose /..- on github, google for the "blog node express tutorial" and try joining the IRC on irc.freenode.net. Interesting channels would be # node.js and possibly ## javascript. From there, people will show you more specialized rooms. I highly recommend you go there, this is a very helpful group.

    The publisher O'Reilly has some very good books, but they are out of date the moment they are sent to the bookstore. As the community develops new features and versions daily, you should try to get as close as possible to the developers of the core features. In IRC, you can even ask them your (possibly interesting) problems - you will get answers and tips, however.

    In short: stay in touch with the community.

+5
source
  • Connect is a powerful and flexible mini structure. I think that with the right set of modules is the best solution.
  • node-mongodb-native for MongoDB, db-mysql for MySQL, just for templates. Use the Node Tool to find more.
  • I am using MongoDB and MySQL. It depends on the project.
  • I use simple JavaScript, but it is a matter of taste. I love my native.
  • Source. Realy. Node.JS ecosystem is developing very fast. Most documentation is out of date at the time of writing. Use GitHub to view projects. This is really helpful.
+2
source
  • Use libraries, not frameworks, except maybe expressjs. Most frameworks tend to complicate the task than it is. Use libraries that are under good licensing conditions. If they are no longer supported, you can at least take on the project.
  • ExpressJS, Jade, Stylus, SocketIO, underscore, jsdom
  • Mongo is definitely the most popular these days. I think the reason is that the console interface uses JavaScript. This creates more “language synergy” with the developer.
  • CoffeeScript has its own quirks, but it's still much better than regular JavaScript. Notice this opinion.
  • I can not help you; I went through the learning process just by reading the online material.
+1
source
  • It depends on your knowledge base. I started by using a bunch of frameworks and worked my way back into understanding basic concepts, but I would recommend starting over again
  • There are more than enough Express guides, and this is a great way to take a ride with node, but it requires a templating engine like Jade or EJS .. (I prefer ejs to render the main .html files). They say node has a ton of basic modules, for example: require ('http'); which are good starting points for understanding the flow of requests.
  • Mongo and Redis are some of the most forgiving db IMOs and have tons of abstraction. although you can go with something more commercial like Parse.com.
  • If you already know JS .. stick with it. otherwise, go to CS to quickly write Javascript and not replace it. In addition, for beginners there are a few more JS examples for online users, but even more options for creating solid coffee script on Git
  • Not quite sure about that. Take a look at Brad Daily's “NodeJS, MongoDB and AngularJS” and google MEAN stack development.
0
source

Source: https://habr.com/ru/post/1400652/


All Articles