NodeJS
文章平均质量分 93
lf_yyyy
技术改变人生
展开
-
Node JS 01 - 基础知识
Node JS 01 - 基础知识什么是 Node.JS官网 : https://nodejs.org/zh-cn/Node.JS 并不是库和框架, 而是一个基于谷歌 V8 引擎(目前公认的解析执行 JavaScript 代码最快的引擎)的 JavaScript 运行时环境,用来解析和执行 JavaScript 代码,也就是说 JavaScript 可以完全脱离浏览器运行.浏览器中的...原创 2019-07-21 12:03:08 · 93 阅读 · 0 评论 -
Node JS 02 - Web服务器开发
Node JS 02 - Web服务器开发IP 地址和端口号ip 地址用来定位计算机端口号用来定位具体的应用一切需要联网通信的应用程序都会占用一个端口号端口号范围是 0 ~ 65536在计算机中有默认占用的端口号,最好不要去使用例如 http 的 80 端口在开发中使用简单好记的端口号就可以,比如 6666 8888 等数据的返回 Content-Type配合 js ...原创 2019-07-21 12:02:51 · 204 阅读 · 0 评论 -
Node JS 03 - 留言板案例
Node JS 03 - 留言板案例关键点 :如何获取到 url 中的参数如何实现页面跳转到原始页面答案 :通过引入 url 模块, 使用 var parseObj = url.parse(req.url,true) 解析 url 并将参数自动封装为对象, 通过 parseObj.query返回参数对象.通过重定向设置请求的状态码为 res.statusCode=302...原创 2019-07-21 12:02:27 · 249 阅读 · 0 评论 -
Node JS 04 - Node 中的模块系统
Node JS 04 - Node 中的模块系统简介使用 Node 编写应用程序主要是在使用:ECMAScript 语言无 BOM 与 DOM核心模块fshttpurlpathos第三方模块art-template自定义模块什么是模块化具有文件作用域具有通信规则加载 require导出CommonsJS 模块规范在 Node ...原创 2019-07-21 12:01:37 · 134 阅读 · 0 评论 -
Node JS 05 - Express
Node JS 05 - Express原生的 http 在某些方面表现不足以应对我们的开发需求, 所以需要使用框架加快开发效率, 使代码更加的高度统一.在 Node 中有很多 Web 开发框架,我们使用 Express .入门安装 : npm install express --savehelloworldvar express = require('express')va...原创 2019-07-21 11:55:48 · 141 阅读 · 0 评论 -
Node JS 06 - CRUD
Node JS 05 - CRUDPath 模块将路径解析为一个对象 :path.parse('c:/b/c/index.html') {root:'C:/',dir:'C:/b/c',base:'index.html',ext:'.html',name:'index'}拼接字符串 :path.join('c:/','b') 自动拼接路径,和分隔符,需要路径拼接的时候使用N...原创 2019-07-21 12:01:05 · 89 阅读 · 0 评论 -
Node JS 07 - 异步编程
Node JS 07 - 异步编程回调函数function add(x,y){ console.log(1) setTimeOut(function(){ console.log(2) return x + y },1000) console.log(3)}//执行结果为 : 1 3 2 //无论 : time 为 1000...原创 2019-07-21 12:00:41 · 74 阅读 · 0 评论 -
Node JS 08 - Node 操作 MongoDB
Node JS 08 - Node 操作数据库操作 MongoDB使用官方 mongodb 包https://github.com/mongodb/node-mongodb-native使用第三方 mongoose第三方包 : mongoose 基于 MongoDB 提供的 MongoDB 包进行再次封装 .起步安装 : npm i mongoosehelloworld/...原创 2019-07-21 12:00:22 · 201 阅读 · 0 评论