Javascript 我如何开始使用 Node.js

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2353818/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-22 23:54:41  来源:igfitidea点击:

How do I get started with Node.js

javascriptnode.js

提问by Joneph O.

Are there any good resources to get started with Node.JS? Any good tutorials, blogs or books?

是否有任何好的资源可以开始使用 Node.JS?有什么好的教程、博客或书籍吗?

Of course, I have visited its official website http://nodejs.org/, but I didn't think the documentation they have is a good starting point.

当然,我访问了它的官方网站http://nodejs.org/,但我不认为他们拥有的文档是一个好的起点。

回答by yojimbo87

Tutorials

教程

Developer Sites

开发者网站

Videos

视频

Screencasts

截屏视频

Books

图书

Courses

培训班

Blogs

博客

Podcasts

播客

JavaScript resources

JavaScript 资源

Node.js Modules

Node.js 模块

Other

其他

回答by Nevir

First, learn the core concepts of Node.js:

首先,学习Node.js的核心概念:

Then, you're going to want to see what the community has to offer:

然后,你会想看看社区提供了什么:

The gold standard for Node.js package management is NPM.

Node.js 包管理的黄金标准是NPM

Finally, you're going to want to know what some of the more popular packages are for various tasks:

最后,您将想知道用于各种任务的一些更流行的软件包是什么:

Useful Tools for Every Project:

每个项目的有用工具:

  • Underscorecontains just about every core utility method you want.
  • Lo-Dashis a clone of Underscore that aims to be faster, more customizable, and has quite a few functions that underscore doesn't have. Certain versions of it can be used as drop-in replacements of underscore.
  • TypeScriptmakes JavaScript considerably more bearable, while also keeping you out of trouble!
  • JSHintis a code-checking tool that'll save you loads of time finding stupid errors. Find a plugin for your text editor that will automatically run it on your code.
  • Underscore包含您想要的几乎所有核心​​实用方法。
  • Lo-Dash是 Underscore 的克隆,旨在更快、更可定制,并且具有很多 underscore 没有的功能。它的某些版本可以用作下划线的替代品。
  • TypeScript使 JavaScript 更容易忍受,同时也让您远离麻烦!
  • JSHint是一种代码检查工具,可以为您节省大量查找愚蠢错误的时间。为您的文本编辑器找到一个插件,它会自动在您的代码上运行它。

Unit Testing:

单元测试:

  • Mochais a popular test framework.
  • Vowsis a fantastic take on asynchronous testing, albeit somewhat stale.
  • Expressois a more traditional unit testing framework.
  • node-unitis another relatively traditional unit testing framework.
  • AVAis a new test runner with Babel built-in and runs tests concurrently.
  • Mocha是一种流行的测试框架。
  • Vows是异步测试的绝佳选择,尽管有些陈旧。
  • Expresso是一个更传统的单元测试框架。
  • node-unit是另一个相对传统的单元测试框架。
  • AVA是一个新的测试运行器,内置 Babel 并同时运行测试。

Web Frameworks:

网络框架:

  • Express.jsis by far the most popular framework.
  • Koais a new web framework designed by the team behind Express.js, which aims to be a smaller, more expressive, and more robust foundation for web applications and APIs.
  • sails.jsthe most popular MVC framework for Node.js, and is based on express. It is designed to emulate the familiar MVC pattern of frameworks like Ruby on Rails, but with support for the requirements of modern apps: data-driven APIs with a scalable, service-oriented architecture.
  • Meteorbundles together jQuery, Handlebars, Node.js, WebSocket, MongoDB, and DDP and promotes convention over configuration without being a Ruby on Railsclone.
  • Tower(deprecated) is an abstraction of a top of Express.js that aims to be a Ruby on Rails clone.
  • Geddyis another take on web frameworks.
  • RailwayJSis a Ruby on Rails inspired MVC web framework.
  • Sleek.jsis a simple web framework, built upon Express.js.
  • Hapiis a configuration-centric framework with built-in support for input validation, caching, authentication, etc.
  • Trailsis a modern web application framework. It builds on the pedigree of Railsand Grailsto accelerate development by adhering to a straightforward, convention-based, API-driven design philosophy.

  • Danfis a full-stack OOP framework providing many features in order to produce a scalable, maintainable, testable and performant applications and allowing to code the same way on both the server (Node.js) and client (browser) sides.

  • Derbyjsis a reactive full-stack JavaScript framework. They are using patterns like reactive programming and isomorphic JavaScript for a long time.

  • Loopback.iois a powerful Node.js framework for creating APIs and easily connecting to backend data sources. It has an Angular.js SDK and provides SDKs for iOS and Android.

  • Express.js是迄今为止最流行的框架。
  • Koa是由 Express.js 背后的团队设计的新 Web 框架,旨在为 Web 应用程序和 API 提供更小、更具表现力和更健壮的基础。
  • Sails.js是最流行的 Node.js MVC 框架,基于 express。它旨在模拟熟悉的 Ruby on Rails 等框架的 MVC 模式,但支持现代应用程序的要求:具有可扩展、面向服务的架构的数据驱动 API。
  • Meteor将 jQuery、Handlebars、Node.js、WebSocketMongoDB和 DDP捆绑在一起,并促进约定优于配置,而不是Ruby on Rails克隆。
  • Tower已弃用)是 Express.js 顶层的抽象,旨在成为 Ruby on Rails 克隆。
  • Geddy是另一种 Web 框架。
  • RailwayJS是一个受 Ruby on Rails 启发的 MVC Web 框架。
  • Sleek.js是一个简单的 Web 框架,建立在 Express.js 之上。
  • Hapi是一个以配置为中心的框架,内置支持输入验证、缓存、身份验证等。
  • Trails是一个现代的 Web 应用程序框架。它建立在RailsGrails的血统之上,通过坚持直接的、基于约定的、API 驱动的设计理念来加速开发。

  • Danf是一个全栈 OOP 框架,提供了许多特性,以生成可扩展、可维护、可测试和高性能的应用程序,并允许在服务器(Node.js)和客户端(浏览器)端以相同的方式进行编码。

  • Derbyjs是一个响应式全栈 JavaScript 框架。他们长期使用响应式编程和同构 JavaScript 等模式。

  • Loopback.io是一个强大的 Node.js 框架,用于创建 API 并轻松连接到后端数据源。它有一个 Angular.js SDK,并提供适用于 iOS 和 Android 的 SDK。

Web Framework Tools:

网络框架工具:

Networking:

联网:

  • Connectis the Rack or WSGI of the Node.js world.
  • Requestis a very popular HTTP request library.
  • socket.iois handy for building WebSocket servers.
  • Connect是 Node.js 世界的 Rack 或 WSGI。
  • Request是一个非常流行的 HTTP 请求库。
  • socket.io可以方便地构建 WebSocket 服务器。

Command Line Interaction:

命令行交互:

  • minimistjust command line argument parsing.
  • Yargsis a powerful library for parsing command-line arguments.
  • Commander.jsis a complete solution for building single-use command-line applications.
  • Vorpal.jsis a framework for building mature, immersive command-line applications.
  • Chalkmakes your CLI output pretty.
  • minimist只是命令行参数解析。
  • Yargs是一个强大的库,用于解析命令行参数。
  • Commander.js是用于构建一次性命令行应用程序的完整解决方案。
  • Vorpal.js是一个用于构建成熟的沉浸式命令行应用程序的框架。
  • Chalk使您的 CLI 输出更漂亮。

Work with streams:

使用流:

回答by Zach B

Use the source, Luke.

使用来源,卢克。

No, but seriously I found that building Node.js from source, running the tests, and looking at the benchmarks did get me on the right track. From there, the .js files in the lib directory are a good place to look, especially the file http.js.

不,但说真的,我发现从源代码构建 Node.js、运行测试和查看基准确实让我走上了正确的轨道。从那里,lib 目录中的 .js 文件是一个很好的查看位置,尤其是文件 http.js。

Update: I wrote this answer over a year ago, and since that time there has an explosion in the number of great resources available for people learning Node.js. Though I still believe diving into the source is worthwhile, I think that there are now better ways to get started. I would suggest some of the books on Node.js that are starting to come out.

更新:我在一年前写了这个答案,从那时起,可供学习 Node.js 的人使用的优秀资源数量呈爆炸式增长。尽管我仍然相信深入研究源代码是值得的,但我认为现在有更好的入门方法。我会推荐一些关于 Node.js 的书籍,这些书籍已经开始问世了。