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的更多相关文章

  1. [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 ...

  2. 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 ...

  3. 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 ...

  4. [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 ...

  5. [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 ...

  6. 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. ...

  7. 【总文档】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 ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. 使用 Flask-Docs 自动生成 Api 文档

    影响我写文档的原因可能是代码和文档分离,有时候写完代码会忘记补文档,而且不能及时查看,使用 Flask-Docs 可以解决我的问题,这个插件可以根据代码注释生成文档页面,代码注释改动文档可以及时更新, ...

  2. 创建一个dynamics 365 CRM online plugin (九) - Context.Depth

    让我们来看看官方文档是怎么讲的 https://docs.microsoft.com/en-us/previous-versions/dynamicscrm-2016/developers-guide ...

  3. Base64编码解码JS

    function Base64() { // private property _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqr ...

  4. 对www.518shengmao.com站资源打包,采用vue Node.js

    最近闲游时间比较多,于是想搞个网站练练手,首先选域名在godday里选了个518shengmao.com,买了个1元的阿里云服务器,接下来程序了. 采用vue+nodejs来开发的 一.NodeJs环 ...

  5. VS2015 IIS Express 无法启动 解决办法

    VS2015启动调试时,总是提示“IIS Web Express 无法启动”的错误, 因为其他项目都可以,就这么一个不行,基本就是配置问题,网上的办法都试了,试了都没用,试试以下解决方案: 用记事本或 ...

  6. 深入理解 ORM框架

    1.ORM是什么? object Relational mapping 对象关系映射,是一种为了解决面向对象与关系型数据库存在不匹配现象的技术,简单说,orm通过描述对象和数据库之间映射的元数据,将程 ...

  7. Kettle解决方案: 第二章 Kettle基本概念

    2概述 设计模块最主要的操作分为: 转换和作业 选择转换和作业后就可以选择对应主对象树和核心对象 主对象树大同小异 核心对象是不同的 比如转换需要用到的CSV表输入, 表输入等都在这里可以选择 而作业 ...

  8. TCP/IP学习20180710-数据链路层-ICMP协议

    1.ICMP协议IP协议不保证数据送达.则应有协议保证数据送达.ICMP就是其中的重要协议.ICMP:(Internet Control Messages Protocol)因特网信报控制协议当传送I ...

  9. (转)android 中uri.parse()用法

    1,调web浏览器 Uri myBlogUri = Uri.parse("http://xxxxx.com"); returnIt = new Intent(Intent.ACTI ...

  10. 基于IPV6数据包分析(GNS3)

    1:实验拓扑 2:检测路由之间的连通性 路由器R4  ping  各路由器 R1路由表 R4路由表 3:抓包分析 A:回送请求报文(Echo Request)  (128)     Type=128, ...