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 ...
随机推荐
- Linux----------rsync的介绍及安装使用
目录 一.rsync的介绍 1.1rsync的特点 二.rsync命令 三.rsync的ssh认证协议 四.ssh协议方式使用方法 五.rsync协议方式使用方法即 (rsync + inotifu- ...
- Linux----------nfs服务器的搭建及常识
一.nfs简介 nfs(network file system)即网络文件系统,是FreeBSD支持的文件系统中的一种,它允许网络中的计算机之间通过TCP/IP网络共享资源. nfs主要适用用linu ...
- oracle错误汇总2
http://blog.itpub.net/30430420/viewspace-1799925/ ============================= 现象!!!!!!!!!!!!!!!!!S ...
- supervisor 文档
supervisor 是用 Python 开发的一个 C/S 服务.是 Linux/Unix 系统下的进程管理工具.它可以很方便的监听.启动.停止.重启一个或多个进程.用Supervisor管理的进程 ...
- react优缺点
优点: 1.面向组件,方便组件的复用. 2.从操作dom改为操作state. 缺点: 1.html和javascript较高耦合,不方便分工开发. 2.当一个页面中两处元素组件有相关性时,父组件会非常 ...
- 更新 TeX Live 软件包
这个 TeX Live 软件,你得时常更新一下,不然会遇到一些由软件包自身 Bug 导致的编译问题.比如,这次我使用 Beamer 软件包写演示文稿,就遇到问题了,结果发现是软件包自身存在的问题.安装 ...
- Python之while循环
1.While循环基础 2.While循环进阶 3.其他
- 协程gevent
协程,利用线程在等待其他资源期间去执行其他的函数. gevent里面封装了greenlet,greenlet里面封装了yield. from gevent import monkey import g ...
- Tomcat应用部署
1.Tomcat安装配置 1.1安装包下载 http://tomcat.apache.org/ 选择下载安装包版本 选择适合当前系统的安装包 安装包目录说明: 1.2环境配置 配置用户名密码conf/ ...
- 2016-08-15T16:00:00.000Z 格式转换成yyyy-MM-dd HH:mm:ss格式
public static String UTCStringtODefaultString(String UTCString) { try { if (CommonUtils.notNullAndEm ...