Node js 和 express js 的区别

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12668880/
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-09-02 16:23:28  来源:igfitidea点击:

Difference between Node js and express js

node.jsexpress

提问by vinod

I am a newbie for node js. What is the use of express JS? According to my understanding it is used for web projects and has some templates like Jade and CSS.

我是 node js 的新手。express JS有什么用?据我了解,它用于 Web 项目,并有一些模板,如 Jade 和 CSS。

Is there anyother extra features in express.js that make it more dominating than node.js? Which one is better node.js or express.js when it comes to server side coding? Diff. between Express.js and node.js.

express.js 中是否还有其他额外功能使其比 node.js 更具统治力?在服务器端编码方面,node.js 或 express.js 哪个更好?差异。Express.js 和 node.js 之间。

Kindly help. Thanks.

请帮忙。谢谢。

回答by defuz

The comparison is not entirely correct. The difference between node.js and express.js in the level of abstraction:

这种比较并不完全正确。node.js 和 express.js 在抽象层次上的区别:

  1. Node.js is a run-time environmentfor building server-side event-driven i/o applicationusing javascript.
  2. Express.js is a framework based on node.jsfor building web-applicationusing principles and approaches of node.js
  1. Node.js 是一个运行时环境,用于使用 javascript构建服务器端事件驱动的 i/o 应用程序
  2. Express.js 是一个基于 node.js框架,用于使用 node.js 的原理和方法构建Web 应用程序

So, if you write web-application, you can try to use Express.js. In all other cases, it does not suit for you.

因此,如果您编写 Web 应用程序,则可以尝试使用 Express.js。在所有其他情况下,它不适合您。

回答by loganfsmyth

Express is built on top of Node, so yes Express adds more features. Node is just a Javascript environment with libraries to make it easy to write software, where Express extends Node specifically to make webservers easy to write.

Express 建立在 Node 之上,所以是的 Express 添加了更多功能。Node 只是一个带有库的 Javascript 环境,可以轻松编写软件,其中 Express 专门扩展了 Node 以使网络服务器易于编写。

Express/Connect adds the concept of middleware, a simplified way of managing different routes, automated integration with several templating engines and a bunch more.

Express/Connect 添加了中间件的概念、管理不同路由的简化方式、与多个模板引擎的自动集成等等。

回答by Rishav Rastogi

Express js is built on top of the Node.js framework.

Express js 建立在 Node.js 框架之上。

Express js uses node.js itself and provides more features to build applications on top Node.js

Express js 使用 node.js 本身,并提供更多功能在 Node.js 之上构建应用程序

http://expressjs.com/, if you look at this link itself it says Express - node.js web application framework.

http://expressjs.com/,如果您查看此链接本身,它会显示Express - node.js Web 应用程序框架。