River从0学习Node.js - 001

目录结构

https://www.nodejs.red/#/

HelloWorld

Node.js REPL(交互式解释器)

Node.js 回调函数

https://www.runoob.com/nodejs/nodejs-callback.html

Node.js 事件循环

https://www.runoob.com/nodejs/nodejs-event-loop.html

观察者模式 | 绑定和触发

Node.js Buffer(缓冲区)

https://www.runoob.com/nodejs/nodejs-buffer.html

处理I/O操作中移动的数据时,就有可能使用 Buffer 库

Node.js Stream()

https://www.runoob.com/nodejs/nodejs-stream.html

  • 文件读写
  • 大文件复制
  • 管道读写操作pipe
  • 链式流(流操作链) - 压缩解压缩文件

Node.js模块系统

https://www.runoob.com/nodejs/nodejs-module-system.html

  • 一个 Node.js 文件就是一个模块
  • exports
  • require

require模块加载

https://www.runoob.com/nodejs/nodejs-module-system.html

Node.js 函数

https://www.runoob.com/nodejs/nodejs-function.html

  • 一个函数可以作为另一个函数的参数
  • 匿名函数
  • HTTP服务

Node.js 路由

https://www.runoob.com/nodejs/nodejs-router.html

Node.js 全局对象

https://www.runoob.com/nodejs/nodejs-global-object.html

__filename

__dirname

setTimeout(cb, ms)

clearTimeout(t)

setInterval(cb, ms)

console.log([data][, ...])

console.info([data][, ...])

console.error([data][, ...])

Process

Node.js 常用工具

https://www.runoob.com/nodejs/nodejs-util.html

util.inherits(constructor, superConstructor) 原型继承

util.isArray(object)

util.isRegExp(object)

util.isDate(object)

util.isError(object)

http://nodejs.org/api/util.html

Node.js 文件系统

https://www.runoob.com/nodejs/nodejs-fs.html

异步和同步

fs.stat

fs.open(path, flags[, mode], callback)

fs.writeFile(file, data[, options], callback)

fs.read(fd, buffer, offset, length, position, callback)

fs.mkdir(path[, options], callback)

fs.readdir(path, callback)

fs.rmdir(path, callback)

https://nodejs.org/api/fs.html#fs_fs_rename_oldpath_newpath_callback

Node.js GET/POST请求

https://www.runoob.com/nodejs/node-js-get-post.html

获取GET请求内容

获取 POST 请求内容

获取 URL 的参数

Node.js 工具模块

https://www.runoob.com/nodejs/nodejs-utitlity-module.html

Node.js Web 模块

https://www.runoob.com/nodejs/nodejs-web-module.html

http 模块主要用于搭建 HTTP 服务端和客户端

使用 Node 创建 Web 服务器

使用 Node 创建 Web 客户端

  • 客户端和服务端有什么区别?

Node.js Express 框架

https://www.runoob.com/nodejs/nodejs-express-framework.html

路由

静态文件

上传文件等操作

Node.js RESTful API

https://www.runoob.com/nodejs/nodejs-restful-api.html

REST 通常使用 JSON 数据格式

RESTful Web Services

GET - 用于获取数据

PUT - 用于更新或添加数据

DELETE - 用于删除数据

POST - 用于添加数据

Node.js 多进程

https://www.runoob.com/nodejs/nodejs-process.html

Node.js 是以单线程的模式运行的

件驱动来处理并发

  • 创建多个子进程,从而提高性能(没有搞明白————)

真=多线程

child_process - 子进程

https://blog.csdn.net/weixin_33850890/article/details/87951062

https://blog.csdn.net/hongchh/article/details/79898816

Master-Worker

https://github.com/hongchh/nodejs-demo/tree/master/multi-process

cluster

1.事件驱动

2.异步编程

3.非阻塞模式的IO

4.轻量高效缺点:

Nodejs

事件

事件监听器 === 多事件监听器

on 函数用于绑定事件函数,

emit 属性用于触发一个事件。

继承 EventEmitter 不会打乱对象原有的继承关系

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。