node note
1.关于next() next()函数接受一个Error对象,在判断错误时,返回这个next()函数,并传入自定义的Error对象可以被向下捕捉,你也可以自定义统一捕捉错误Error的中间件,在app。js里面。
2.关于Error:你可以设置他的message和status,否则就用默认的错误码与错误信息返回到前端,这些都需要在app.js自定义进行设置。express框架已有自定义值。
3.关于回调函数:可以用promise进行回调函数的封装。封装成promise时返回一个promise对象,调用时在then()函数内也返回想要进行处理的相应promise封装函数,就可以进行链式调用。
4.关于promise:如果想在链式调用中终止promise的调用,可以尝试throw 出一个Error对象,而这可以被最终链式调用的catch()函数捕捉,再将中返回到next()函数上,最终就可以被统一处理错误的中间件处理返回前端。
5.关于linux布node:环境变量配制方法:
修改/etc/profile文件,在末尾添加以下内容
|
1
2
|
export NODE_HOME=//Node所在路径export PATH=$NODE_HOME/bin:$PATH |
修改完成后需要重新登陆才能生效,也可以执行命令 source /etc/profile 或者 . /etc/profile来生效(注意。与/etc/profile中有一个空格)
node note的更多相关文章
- [LeetCode] Delete Node in a BST 删除二叉搜索树中的节点
Given a root node reference of a BST and a key, delete the node with the given key in the BST. Retur ...
- Delete a node from BST
Given a root node reference of a BST and a key, delete the node with the given key in the BST. Retur ...
- Leetcode: Delete Node in a BST
Given a root node reference of a BST and a key, delete the node with the given key in the BST. Retur ...
- [Leetcode]450. Delete Node in a BST
Given a root node reference of a BST and a key, delete the node with the given key in the BST. Retur ...
- [Swift]LeetCode450. 删除二叉搜索树中的节点 | Delete Node in a BST
Given a root node reference of a BST and a key, delete the node with the given key in the BST. Retur ...
- 450. Delete Node in a BST 删除bst中的一个节点
[抄题]: Given a root node reference of a BST and a key, delete the node with the given key in the BST. ...
- 【总文档】rac增加新节点的方法步骤 How to Add Node/Instance or Remove Node/Instance in 10gR2, 11gR1, 11gR2 and 12c Oracle Clusterware and RAC
[总文档]How to Add Node/Instance or Remove Node/Instance in 10gR2, 11gR1, 11gR2 and 12c Oracle Clusterw ...
- LeetCode OJ 450. Delete Node in a BST
Given a root node reference of a BST and a key, delete the node with the given key in the BST. Retur ...
- 450. Delete Node in a BST
Given a root node reference of a BST and a key, delete the node with the given key in the BST. Retur ...
随机推荐
- python 执行oracle、python脚本文件
import os # sql脚本结尾加';'!!! os.system('sqlplus.exe scott/s123@127.0.0.1:1521/ORCL @D:/PycharmProjects ...
- 前后台数据交换,printwriter、jsonobject、jsonarray、ajax请求,数据交换
后台代码: public void findByIDEquipment() { getResponse().setCharacterEncoding("UTF-8"); getRe ...
- Metabase研究 开源的数据报表
https://blog.csdn.net/bin330720911/article/details/79273317 https://blog.csdn.net/qq_35902833/articl ...
- 初次使用BAT,请检查Chrome浏览器和ChromeDriver兼容性
ChromeDriver可以理解为Chrome驱动,它是架在BAT程序和Chrome之间的桥梁.但是ChromeDriver的问题是,每个版本的兼容范围很窄,通常只能兼容3个Chrome版本. 因此, ...
- spark2.1源码分析4:spark-network-common模块的设计原理
spark-network-common模块底层使用netty作为通讯框架,可以实现rpc消息.数据块和数据流的传输. Message类图: 所有request消息都是RequestMessage的子 ...
- JAVA之Mybatis基础入门--框架搭建与简单查询
JAVA中,操作数据库有JDBC.hibernate.Mybatis等技术,今天整理了下,来讲一讲下Mybatis.也为自己整理下文档: hibernate是一个完全的ORM框架,是完全面向对象的.但 ...
- 级联Cascade
cascade分为两类: 1.JPA标准 2.Hibernate标准 JPA的方法使用JPA规范 如@OneToMany(cascade=CascadeType.ALL,mappedBy=" ...
- ABAP笔记
ABAP程序开发,经常会遇到报表开发需求.使用ABAP的Report类型程序开发报表十分便利,用很少的代码就可以快速开发出一个报表.这种报表需求,抛开各种细枝末节,都可以归结为“三步走”:1.选择屏幕 ...
- 通过SQLServer的数据库邮件来发送邮件
前段时间需要做一个发送邮件的功能,于是就花了一点时间研究了一下.发现通过SQLServer就可以发送邮件,只需要配置一下就可以了,而且配置过程很简单.下面来说一下配置过程: 1.启用Database ...
- leetCode53. 最大子序和
示例: 输入: [-2,1,-3,4,-1,2,1,-5,4], 输出: 6 解释: 连续子数组 [4,-1,2,1] 的和最大,为 6. 进阶: /** * @param {number[]} nu ...