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 ...
随机推荐
- docker(基础篇)
http://naotu.baidu.com/file/f02773930afb2d3d9e71621249099d31 centos7安装 https://yq.aliyun.com/articl ...
- git代理配置
命令行模式下配置 git config --global https.proxy https://proxyuser:proxypassword@ip/域名:port git config --glo ...
- Java String类和StringBuffer类的区别
1.String与StringBuffer的区别简单地说,就是一个变量和常量的关系.StringBuffer对象的内容可以修改:而String对象一旦产生后就不可以被修改,重新赋值其实是两个对象.St ...
- git 放弃本地修改,强制拉取更新
开发时,对于本地的项目中修改不做保存操作(或代码改崩),可以用到Git pull的强制覆盖,具体代码如下: git fetch --all git reset --hard origin/master ...
- CentOS7.5 安装MySQL8 tar
1.查看是否安装mariadb 执行命令: [root@mysql ~]# rpm -qa | grep mariadb 显示: mariadb-libs-5.5.56-2.el7.x86_64 2. ...
- ssh:22端口拒绝服务
在Hadoop配置中,被这个问题坑的死去活来的.总结一下,注意以下几点: 1.sshd是否启动.一般你ssh loaclhost的时候22端口拒绝,就很有可能是这个问题了. 手动打开:/etc/ini ...
- python基础知识7---补充
''' 不可变:数字,字符串,元组 可变:列表,字典 原子:数字,字符串 容器:列表,元组,字典 直接访问:数字 顺序:字符串,列表,元组 映射访问:字典 ''' #一一对应 a,b,c,d,e='h ...
- Tomcat应用部署
1.Tomcat安装配置 1.1安装包下载 http://tomcat.apache.org/ 选择下载安装包版本 选择适合当前系统的安装包 安装包目录说明: 1.2环境配置 配置用户名密码conf/ ...
- python之路——19
王二学习python的笔记以及记录,如有雷同,那也没事,欢迎交流,wx:wyb199594 复习 1.正则表达式 1.字符组 2.元字符 \w \d \s 匹配任意字母数字下划线 数字 空格 \W \ ...
- note 5 二分法求平方根,素数,回文数
+二分法求平方根 x = float(raw_input('Enter the number')) low = 0 high = x guess = (low + high ) / 2 if x &l ...