📜  Node.js 与 Vue.js

📅  最后修改于: 2021-09-14 01:28:04             🧑  作者: Mango

Node.js:它是一个 JavaScript 运行时环境,它建立在 Chrome 的 V8 JavaScript 引擎之上。它由在 Google Brain 工作的软件工程师 Ryan Dahl 开发,他还开发了 Deno JavaScript 和 TypeScript 运行时。 Node.js 是跨平台和开源的,它在服务器端(即在 Web 浏览器之外)执行 JavaScript 代码。由于其单线程特性,它主要用于事件驱动、非阻塞服务器,非阻塞 I/O 模型使其轻量级和高效,因此最适合数据密集型实时应用程序。它由传统网站和后端 API 服务使用。它采用实时、基于推送的架构设计,可跨分布式设备运行。 HTTP(超文本传输协议)模块提供了一组用于构建 HTTP 服务器的类和函数。我们为这个基本的 HTTP 服务器使用本地节点,如文件系统、路径和 URL。

Vue.js:它是一个开源的渐进式 JavaScript 框架,主要用于构建 UI 和单页应用程序。它由 Evan 创建,他由 Patreon 上的社区资助开发 VueJS。它与大多数现代技术兼容,并且由于其温和的学习曲线和可扩展性,因此广受欢迎。 VueJS 遵循 Model-View-ViewModel (MVVM) 架构模式,其中 ViewModel 有一个 ‘Vue’ 实例,View 和 Model 由双向数据绑定。它使用虚拟 DOM,在 API 和设计方面,与 AngularJS 相比,Vue 更容易学习。由于路由和状态的问题是在 ReactJS 中处理的,与 Vue 由关联库处理它的方式相同。

Node.js 和 Vue.js 的区别:

Node.js Vue.js
Node.js is a cross-platform and open-source back-end framework that executes JavaScript code on the server-side. Vue.js is a structural, open-source JavaScript framework that is used for building UIs and single-page applications.
The learning curve of Node.js is High [71500 stars on GitHub (as of July 2020)]. The learning curve of Vue.js is comparatively Low.
Support Model–view–controller (MVC) framework. Support Model-View-ViewModel(MVVM) pattern.
Written in C/C++. Written in Javascript and Typescript..
It allows you to run JavaScript code on the server-side and Handles requests from the browser. It is used to build single-page, client-side applications.
Real-time data streaming is handled easily.   Real-time data streaming is not handled by VueJS.
It is fast and lightweight which makes it usable for writing micro-services.  It is faster than any other UI framework and setting-up to an existing project is easy.
It runs on chromes v8 engine and uses an event-driven, non-blocking I/O model. It uses JavaScript run-time ‘Node.js’ to compile and run.
No DOM (Document Object Model) is Used. Virtual DOM (Document Object Model) is Used.
Being single-threaded handles requests easy and fast. Axios library is used to handle AJAX requests.
Apps using Node.js: LinkedIn, Uber, Netflix, PayPal, Trello, Capital One, Yahoo, Mozilla, etc Apps using Vue.js: Google, Apple, Nintendo, Behance, Oval Money, Trivago, Font Awesome, Gitlab, etc.
if(gfg) {
console.log("Geeks for Geeks"); }

Geeks for Geeks