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 ...
随机推荐
- Java技术开发程序员如果在2019年立足
2019年的互联网环境相对以往来说要更复杂一些,互联网领域也正在经历从消费互联网向产业互联网转型的阵痛期.其实不少公司从2018年开始已经在陆续进行结构化调整,这些调整中的重要内容就是岗位调整,而岗位 ...
- R-shiny服务器安装及配置
R的shiny 服务器管理-入门http://www.bio-info-trainee.com/1683.html sudo systemctl start shiny-serversudo syst ...
- g2o
高翔博士 g2o的代码框架 https://www.cnblogs.com/gaoxiang12/p/5304272.html 图优化理论和g2o的引入 https://www.cnblogs.com ...
- ORACLE 存储过程中保存用户自定义异常信息的一种方式
1.创建错误日志表: create table REP_LOGS ( log_s_no NUMBER not null, log_date DATE default sysdate not null, ...
- Win10 使用MinGW-w64编译Tesseract4.0
一开始尝试使用mingw+msys编译tesseract, 但是苦于mingw-get安装的软件版本都太旧,要安装新版本只能下载源码编译安装. 在编译过程中遇到了很多麻烦,最后还遇到了包直接循环依赖问 ...
- Nginx配置CI框架问题(Linux平台下Centos系统)
CI框架:官方文档 http://codeigniter.org.cn/user_guide/index.html CI框架的数据流程图如下: 其中:index.php作为入口文件,在安装好CI框架后 ...
- 爬虫系列2:Requests+Xpath 爬取租房网站信息
Requests+Xpath 爬取租房网站信息 [抓取]:参考前文 爬虫系列1:https://www.cnblogs.com/yizhiamumu/p/9451093.html [分页]:参考前文 ...
- 常用内置函数_eval_exce
内置函数 abs 绝对值函数 res = abs(-19) print(res) round 四舍五入(n.5时, 奇数进偶数不进) sum 计算序列的和(元素是数字类型) listvar = (1, ...
- linux操作系统中安装redis
第一步:安装gcc编译软件 redis是用c编写的,在下载之后需要使用gcc编译之后才能安装,首先需要下载gcc yum install gcc-c++ 第二步 下载redis安装包,并解压编译 ...
- sql中的等于和不等于, '=' ,'!=','<>','is null'....
不等于:<> ,!=,~= ,^= 这四个符号据说都可以在oracle中表示不等于,但是试了之后发现<> ,!= ,^=是可以的,~=不行,需要注意的是,只有<>是 ...