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 ...
随机推荐
- proxmox网络
root@t1:~# cat /etc/network/interfaces# network interface settings; autogenerated# Please do NOT mod ...
- 浏览器输入url回车后,会发生什么?
通常我们想访问某一个网址,我们会在浏览器中输入它的域名,然后点击回车进行跳转,这样就可以进到网站的主页,看似简单的两步,其实背后都需要大量的代码在运行,支持,才能完成!那浏览器到底都做了哪些事呢? 一 ...
- 18.7 修改IP地址
ifconfig #查看ip sudo ifconfig eth3 10.3.10.232 #修改ip
- IDEA编译时出现 Information:java: javacTask: 源发行版 1.8 需要目标发行版 1.8
错误如下 检查下面几个地方设置是否一致... 1.Project Structure下(File->Project Structure...) Sources选项卡->Languate l ...
- Mybatis中 Integer 值为0时,默认为空字符串的解决办法。
需求是查询级别为0的用户 User对象里的level字段的值为0,查询时居然没有查到为level为0的用户. <select id="selectSelective" par ...
- log4j2 实际使用详解
转载至: https://blog.csdn.net/vbirdbest/article/details/71751835 如下是maven项目中的实例: 首先pom.xml中引入如下依赖,注意看都是 ...
- amd显卡更新最新驱动鼠标顿卡的解决方法
测试了下游戏,很稳.方法:在卡顿的状态下打开RADEON设置,依次点击显示器→规格→覆盖,将支持HDCP选为禁用,按提示重启即可.
- iptables禁止某个mac地址上网
iptables -I FORWARD -m mac --mac-source 60:14:B3:7D:6B:39 -j DROP 上面这条命令测试过是可行,禁止这个mac地址上网,马上禁止马上生 ...
- Python中多个列表与字典的合并方法
Python中多个列表与字典的合并方法 1多列表的合并 1)a+=b a=['] b = ['] a += b print(a) >>>['] 2) a.extend(b) a=[' ...
- [trouble] error connecting to master 'repl@192.168.1.107:3306' - retry-time: 60 retries: 86400
本文转自https://www.cnblogs.com/hellotracy/articles/5183057.html因为碰到同样的问题所以记录下. 很多时候,就算thread 正在进行,也不代表没 ...