简体   繁体   English

与Django和Python相比,Node.js在JavaScript和Express之间的MEAN堆栈中扮演什么角色?

[英]What role does Node.js play in MEAN stack between JavaScript and Express compared to Django and Python?

I have background in implementing web applications using Python and its popular framework Django and PostgreSQL. 我有使用Python及其流行的框架Django和PostgreSQL实现Web应用程序的背景。 Recently I've shifted my attention from Python to JavaScript and planned to take advantage of the benefits that MEAN stack has to offer. 最近我将注意力从Python转移到了JavaScript,并计划利用MEAN堆栈提供的优势。

In terms of backend structure, I understand MongoDB is the database to MEAN just like PostgreSQL (and other relational database) is to Python. 就后端结构而言,我理解MongoDB是MEAN的数据库,就像PostgreSQL(和其他关系数据库)是Python一样。 Express is the framework just like Django. Express就像Django一样是框架。 However, where does Node.js fit into? 但是,Node.js适合哪些地方? What does it do? 它有什么作用? What's the equivalent of Node.js in a Django structure? 在Django结构中,Node.js的等价物是什么? Why does Django+Python combination not need this "extra" layer of abstraction? 为什么Django + Python组合不需要这个“额外”的抽象层? What feature(s) do JavaScript lack that it needs this extra layer? JavaScript缺少什么功能需要这个额外的层?

I know it might be a simple question but I'm having a hard time understanding it! 我知道这可能是一个简单的问题,但我很难理解它! Thank you very much in advance! 非常感谢你提前!

Node is the interpreter/environment. Node是解释器/环境。 It's literally the thing that is executing your JavaScript code. 这实际上就是执行JavaScript代码的事情。 I think a better comparison is to think about how the JVM relates to Java 我认为更好的比较是考虑JVM与Java的关系

Note that "Javascript" is not in the acronym, whereas with something like LAMP, Python (or PHP or whichever) is. 请注意,“Javascript”不是首字母缩略词,而是像LAMP,Python(或PHP或其中任何一个)那样。 In MEAN, Node.js takes the place of Javascript. 在MEAN中,Node.js取代了Javascript。

Node.js is basically an interpreter and a runtime environment for Javascript. Node.js基本上是Javascript的解释器和运行时环境。 It is used in the acronym rather than Javascript to distinguish it as separate from browser Javascript. 它用在首字母缩略词而不是Javascript中,以区别于浏览器Javascript。 Plus, MEAJ is a pretty horrible acronym. 另外,MEAJ是一个非常可怕的缩写。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM