哪个技术栈(模块、框架)比较适合第一个node.js项目,研究node,做出好的产品? [英] Which technology stack (modules, frameworks) is better for the first node.js project in order to study node and make a good product?

查看:24
本文介绍了哪个技术栈(模块、框架)比较适合第一个node.js项目,研究node,做出好的产品?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一年前,我在 node.js 中做了一些小步骤.即便如此,仍有大量的模块和框架.现在我想更深入地学习 node 环境并开始一个基于 web 的(web 和移动应用程序服务)项目.我知道很多事情取决于您正在编写的应用程序类型,但其中总有某种基础.

此时我想知道:

  1. 从头开始还是采用某种框架(您认为哪种框架)更好?
  2. 哪些模块最重要?我应该首先关注哪些模块?
  3. 您更喜欢哪些数据库和模块?
  4. 我听说你可以为 node 编写咖啡脚本.我该怎么做?或者也许使用 javascript 更好?
  5. 关于一些关于 node in action 的有用书籍和教程.

所有这些问题都相当广泛,但答案对所有初学者都非常有帮助

谢谢)

解决方案

我将尝试从一个尝试通过并发开发具有不同状态"组合的相同项目进入 Node.js 的人的角度来回答您的问题艺术模块.

  1. 与往常一样,项目的复杂性决定了方法.如果您想了解 Node 的全部复杂性,您可以从头开始构建,并在需要时仅使用相关库(例如连接和数据库层抽象,如 cradle 或 mongoose,更多在答案 2 中).他们.

    如果您想拥有一个可以从中找到可行解决方案的代码库,您应该选择 Express 框架(建立在连接上),因为它似乎在节点开发人员中最普遍.许多教程站点都提供了易于理解的包含此框架的示例.Bogart 模块也会做同样的事情,但它并不为公众所知.

  2. 除了 Express 之外,您可能还想为您的 HTML 输出查看模板系统.为此,我建议使用 Jade.我将在答案 4 中解释原因.另一种选择是 Mustache 或 EJS.

    那你应该看看 cradlemongoose,因为方便的数据库访问需要这些模块.既然已经涵盖了核心功能和数据库,您可能想要查看 LESS 或 SASS 模块的 CSS 魔法.

    身份验证可以由 everyauth 处理,它提供 twitter、facebook 和更多 oauth 功能.

  3. 我想我已经涵盖了 2. 中的模块,现在进入数据库问题.我确实喜欢使用 MongoDB,您可以轻松地使用它并在 Internet 上找到大量文档和最佳实践.我自己发现 CouchDB 更有趣,因为它提供了一个很棒的基于 API 的访问,它的标语是放松".——但其实没那么重要.只要您了解驱动 mongo 和 couch 的 NoSQL 方法,您就可以使用它们中的任何一种.我强烈建议避免使用传统的基于 SQL 的数据库,因为 NoSQL 数据库系统的 JSON 格式的输出无缝集成到 Node.js 的 JavaScript 环境中.>

  4. 我是用 JS 和 Coffee 开发的,我可以告诉你一件事:喝一杯后者,你会更容易启动和运行你的项目.基于缩进的编程与同样对缩进敏感的 Jade 模板系统携手并进.对服务器代码和视图代码(和 CSS,即使缩进只是为了您自己的方便)具有相同的思维方式,可以更轻松地同时开发两者.我还没有从 JS 中找到一个问题,它无法用更漂亮的 CoffeeScript 表达式来解决.

  5. 关注 github 上的 node 项目,关注 github 上的 Express/Connect/cradle/Jade/mongoose/..-project,谷歌搜索博客节点快速教程"并尝试加入 IRC社区.有趣的频道是#node.js 和##javascript.从那时起,人们会带您参观更专业的房间.我强烈建议你去那里,这是一群非常有帮助的人.

    O'Reilly 出版商有一些非常好的书,但它们在运到书店的那一刻就已经过时了.由于社区每天都在开发新功能和新版本,因此您应该尝试尽可能接近核心功能的开发人员.在 IRC 上,您甚至可以向他们提出您的(可能有点有趣)的问题——尽管如此,您还是会得到答案和提示.

    简而言之:与社区保持联系.

A year ago I made few small steps in node. Even then there was a great number of modules and frameworks. Now I want to learn the node environment more deeply and start a web based (service for web and mobile app) project. I understand that a lot of things depends on what sort of application you're writing, but there is always some kind of base in it.

At this point I would like to know:

  1. Is it better to start from scratch or take some kind of framework (which one in your opinion)?
  2. Which modules are of the prime importance? On which modules should I pay attention in the first place?
  3. Which databases and modules do you prefer?
  4. I've heard that you can write to coffeescript for node. What should I do for it? Or maybe it's better to use javascript?
  5. About some helpful books and tutorials about node in action.

All these questions are rather broad, but the answers will be very helpfull for all beginners

Thanks )

解决方案

I will try answering your question from the view of someone who has tried getting into Node.js through concurrent development of an identical project with different combinations of 'state of the art' modules.

  1. The complexity of your project dictates the approach, as usual. If you want to learn the whole range of the intricacies of Node, you can build from scratch and just use relevant libraries (such as connect and database layer abstraction such as cradle or mongoose, more in Answer 2.) when you have the need for them.

    If you want to have a codebase from which you can find workable solutions, you should go for the Express framework (built upon connect), since it seems to be the most widespread among node developers. Many tutorial sites supply easy-to-follow examples that include this framework. The Bogart module will do the same, but it is not as publically known.

  2. Apart from Express, you might want to look into a Templating System for your HTML output. I would suggest Jade for that. I will explain why in Answer 4. An alternative would be Moustache or EJS.

    Then you should check out cradle or mongoose, since these modules will be needed for convenient DB access. Now that core functionality and DB are covered, you might want to look into LESS or SASS modules for CSS magic.

    Authentication can be handled by everyauth, it supplies twitter, facebook and many more oauth functions.

  3. I think i have covered the modules in 2. already, so now onto the DB question. I did enjoy working with MongoDB, and you can easily go with that and find alot of documentation and best-practices on the Internet. I myself have found CouchDB much more interesting, since it provides a fantastic API-based access and it's catchphrase is "Relax." - but it is not really that important. As long as you understand the NoSQL-approach that drives mongo and couch, you can use any of them. I strongly suggest to avoid traditional SQL-based databases since the JSON-formatted output of the NoSQL database systems integrates seamlessly into the JavaScript-environment that is Node.js.

  4. I developed with JS and Coffee and i can tell you one thing: with a cup of the latter, you will have a much easier time getting your projects up and running. Indentation-based programming plays hand in hand with Jade Templating system, which is also indentation-sensitive. Having the same mindset for server code and view code (and CSS, even thou indentation there is just for your own convenience) makes developing both at the same time much easier. I have yet to find a problem from JS that could not be solved with a much more beautiful CoffeeScript expression.

  5. Follow the node project on github, follow the Express/Connect/cradle/Jade/mongoose/..-project on github, google for "blog node express tutorial" and try joining the IRC community on irc.freenode.net. The interesting channels there would be #node.js and maybe ##javascript. From there on, people will show you to more specialized rooms. I strongly suggest you go there, it is a very helpful bunch.

    The O'Reilly publisher has some very good books, but they are outdated the moment they are shipped to the bookstore. Since the community is developing new features and versions on a daily basis, you should try to get as close to the developers of the core functionality as possible. On IRC, you can even ask them with your (probably mildly interesting) problems - you will get answers and hints nonetheless.

    In short: stay in touch with the community.

这篇关于哪个技术栈(模块、框架)比较适合第一个node.js项目,研究node,做出好的产品?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆