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. 使用sphinx快速为你python注释生成API文档

    sphinx简介sphinx是一种基于Python的文档工具,它可以令人轻松的撰写出清晰且优美的文档,由Georg Brandl在BSD许可证下开发.新版的Python3文档就是由sphinx生成的, ...

  2. day059-60 ajax初识 登录认证练习 form装饰器, form和ajax上传文件 contentType

    一.ajax 的特点 1.异步交互:客户端发出一个请求后,需要等待服务器响应结束后, 才能发出第二个请求 2.局部刷新:给用户的感受是在不知不觉中完成请求和响应过程. 二.ajax 模板示例 ($.a ...

  3. dic and set

    一.dic 1.格式:key:value 2.key值必须不可变(可hash) 3.key不可重复(唯一性) 4.优点:查找.插入速度快 5.缺点:空间消耗大 6.实质是以空间换速度 7.常用参数 1 ...

  4. 前端基础:web语义化

    web语义化 一.什么是web语义化? web语义化包含两方面,一是html标签语义化,简单来说就是要用合适的标签来表述适当的内容,标题用<h1>~~<h6>标签,段落用< ...

  5. ASP.NET MVC 枚举类型转LIST CONTROL控件

    在实际应用中,我们经常会用到下拉框.多选.单选等类似的控件,我们可以统称他们为List Control,他们可以说都是一种类型的控件,相同之处都是由一个或一组键值对的形式的数据进行绑定渲染而成的. 这 ...

  6. Linux基础入门-Linux下软件安装

    一.在线安装: sudo apt-get install 即可安装 如果在安装完后无法用Tab键补全命令,可以执行: source ~/.zshrc APT(Advanced Packaging To ...

  7. 【配置阿里云 I】申请配置阿里云服务器,并部署IIS和开发环境,项目上线经验

    https://blog.csdn.net/vapaad1/article/details/78769520 最近一年在实验室做web后端开发,涉及到一些和服务器搭建及部署上线项目的相关经验,写个帖子 ...

  8. ORACLE 数据库使用正则表达式重新计算指定位置的数字为新的数字

    昨天工作中遇到这个问题: 有一个这样的字符串expression变量,里面可能存储的值类似于以下[Index_CivilWork,0]*(1+[Y10814,1])/[Y10674,1] [300,1 ...

  9. XPath定位时,使用文本的方法小技巧。

    1)//td[text()= "{0}" ]  #这是一种非常常用的定位方法,具体例子使用如下: __keyboard = '//td[text()= "{0}" ...

  10. python判断平台

    网上找到的判断平台的方法,特此记录 # -*- coding: utf-8 -*- import platform osName = platform.system() if(osName == 'W ...