当前位置: 代码网 > it编程>编程语言>Javascript > Nodejs

Nodejs

2024年08月03日 Javascript 我要评论
官方解释:Node.js发布于2009年5月,由Ryan Dahl开发,是一个基于Chrome V8引擎的JavaScript运行环境,使用了一个事件驱动、非阻塞式I/O模型, [1] 让JavaScript 运行在服务端的开发平台,它让JavaScript成为与PHPPythonPerlRuby等服务端语言平起平坐的[脚本语言]Node.js 的出现吸引了很多前端开发人员开始用 JavaScript 开发服务器代码,其异步编程风格也深受开发人员的喜爱。

node.js is a runtime environment that allows you to run javascript code outside of a web browser. it uses the v8 javascript engine from google chrome and provides a set of built-in modules that enable you to build scalable and efficient web applications.

with node.js, you can create server-side applications and apis, handle file operations, perform network operations, and much more. it uses an event-driven, non-blocking i/o model, which makes it suitable for building real-time applications, such as chat servers or streaming services.

node.js also has a package manager called npm (node package manager), which allows you to install and manage third-party libraries and modules for your projects. this vast ecosystem of modules and libraries makes it easy to extend node.js with additional functionality.

overall, node.js has gained popularity among developers due to its performance, scalability, and the ability to write server-side applications using javascript – a language that is already familiar to many web developers.

1.nodejs的安装

npm是node提供的模块管理工具,可以非常方便的下载安装很多前端框架,包括jquery、angularjs、vuejs都有。为了后面学习方便,我们先安装node及npm工具.

1.1.安装nodejs

nodejs自带npm,安装好nodejs就安装好了npm

  • nodejs下载:node.js — download node.js®

  • 安装:双击安装,如果是绿色版,直接解压缩,配置环境变量

  • 升级:npm install npm@latest -g [不升级]

  • 测试node:cmd -> node -v

  • 测试npm: cmd -> npm -v

  • 淘宝镜像:npm config set registry https://registry.npm.taobao.org

  • 腾讯镜像:npm config set registry tencent-npm [推荐]

1.2.cnpm的使用

淘宝团队做的国内镜像,因为npm的服务器位于国外可能会影响安装。淘宝镜像与官方同步频率目前为 10分钟 一次以保证尽量与官方服务同步。

  • 安装:命令提示符执行 npm install cnpm -g --registry=https://registry.npm.taobao.org

  • 测试cnpm :cnpm -v

    2.nodejs介绍

    2.1.介绍

    官方解释:

    简单理解:nodejs是一个javascript运行环境,让javascript开发服务端代码成为可能

    简单理解:npm是在nodejs平台上的js包管理系统,如安装jquery:npm install jquery , 为了方便理解下面有一个对比:

    jdk、jre(java开发、运行平台)nodejs(js运行平台)
    后端应用开发前端应用开发
    maven:管理jar包npm:管理js库
    springboot+ssm架构开发项目vue技术栈,react技术

    随后,在node的基础上,涌现出了一大批的前端框架:angular(mvc->mvvm),vue(mvvm)等等

    2.2.主流前端框架

    前端框架三巨头:

  • vue.js:vue.js以轻量易用著称

  • react.js:vue.js和react.js发展速度最快, 集web前端与app于一身技术

  • angularjs:angularjs是曾经的老大。

(0)

相关文章:

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2025  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com