基于 Koa平台Node.js开发的KoaHub.js的跳过组件代码
koahub-skip
koahub skip middleware
koahub skip
Conditionally skip a middleware when a condition is met.
Install
npm i koahub-skip --save
Usage
With existing middlewares:
If you are authoring a middleware you can support skip as follow:
Current options
method
it could be an string or an array of strings. If the request method match the middleware will not run.path
it could be an string, a regexp or an array of any of those. If the request path match, the middleware will not run.ext
it could be an string or an array of strings. If the request path ends with one of these extensions the middleware will not run.custom
it must be a function that returnstrue
/false
. If the function returns true for the given request, ithe middleware will not run. The function will have access to Koa's context viathis
useOriginalUrl
it should betrue
orfalse
, default istrue
. if false,path
will match againstctx.url
instead ofctx.originalUrl
.
Examples
Require authentication for every request skip the path is index.html.
Avoid a fstat for request to routes doesnt end with a given extension.
基于 Koa平台Node.js开发的KoaHub.js的跳过组件代码的更多相关文章
- 基于 Koa平台Node.js开发的KoaHub.js的控制器,模型,帮助方法自动加载
koahub-loader koahub-loader是基于 Koa平台Node.js开发的KoaHub.js的koahub-loader控制器,模型,帮助方法自动加载 koahub loader I ...
- 基于 Koa平台Node.js开发的KoaHub.js连接打印机的代码
最近好多小伙伴都在做微信商城的项目,那就给大家分享一个基于 Koa.js 平台的 Node.js web 开发的框架连接微信易联云打印机接口的代码,供大家学习.koahub-yilianyun 微信易 ...
- 基于 Koa平台Node.js开发的KoaHub.js获取/设置会话功能代码
koa-session2 Middleware for Koa2 to get/set session use with custom stores such as Redis or mongodb ...
- 基于 Koa平台Node.js开发的KoaHub.js的静态服务器重写和索引代码
koa-static-server Static file serving middleware for koa with directory, rewrite and index support k ...
- 基于 Koa平台Node.js开发的KoaHub.js的模板引擎代码
koahub-handlebars koahub-handlebars koahub handlebars templates Installation $ npm install koahub-ha ...
- 基于 Koa平台Node.js开发的KoaHub.js的输出json到页面代码
koahub-body-res koahub body res Format koa's respond json. Installation $ npm install koahub-body-re ...
- 基于LBS平台的iOS开发
LBS,即Location Based Services,基于位置服务,用于定位.导航等功能,比如地图应用.订外卖等的app就需要这个功能. 在这里我使用的是高德LBS开放平台,地址:http://l ...
- 基于CkEditor实现.net在线开发之路(2)编写C#代码,怎么调用它。
上一章简约的介绍了CkEditor编辑器,可以编辑js逻辑代码,css,html,C#代码,这章我根据实际例子,讲解怎么编写C#代码和怎么调用它. 大家都还记得刚刚接触程序编时的hello Word吧 ...
- 基于CkEditor实现.net在线开发之路(1)
我以前的公司使用office sharepoint designer为界面设计器,嵌套各种自定义控件,进行各种管理软件,工作流的开发,遇到比较复杂的逻辑,则采用本地写类库,生成DLL上传到服务器,通过 ...
随机推荐
- java如何获取本机IP
java如何获取本机IP import java.net.*; public class Test6 { public static void main(String[] args) { // TOD ...
- xhtmlrenderer渲染pdf,中文换行
在实际开发中,发现在table中显示中文,渲染出来的pdf,中文内容不自动换行.经过搜索发现了一种解决方案,如下: 重写Breaker,修改right计算方式 /* * Breaker.java * ...
- Java Swing paint repaint update 方法的关系
Java Swing paint repaint update 方法的关系: 参考:http://blog.csdn.net/xiaoliangmeiny/article/details/691665 ...
- MalformedObjectNameException: Invalid character '' in value part of property
http://blog.csdn.net/getdate/article/details/6729706 ojdbc6.jar的问题: 最近在项目中用spring配置oracle数据库连接池, 启动的 ...
- 爱你不容易 —— Stream详解
作为前端,我们常常会和 Stream 有着频繁的接触.比如使用 gulp 对项目进行构建的时候,我们会使用 gulp.src 接口将匹配到的文件转为 stream(流)的形式,再通过 .pipe() ...
- 数据库SQL,NoSQL之小感悟
遇到1000万数据表 最近遇到一个问题,就是单表数据过的存储及查询问题.举个例子:1000万的数据存在一个表中,字段4-5个样子,日常 开发中难免要做过滤.排序.分页.如果把这几个放在一起即要过滤又要 ...
- C#下控制台程序窗口下启用快速编辑模式运行线程会阻止线程运行
最近做一个小的功能,使用C#控制台程序开启一个线程进行无限循环没5秒处理一次程序,发现控制台窗口在开启快速编辑模式情况下,进行选择程序打印 出来的文字后发现线程不走了,将快速编辑模式去除后,线程就不会 ...
- Java实现二叉树的前序、中序、后序遍历(递归方法)
在数据结构中,二叉树是树中我们见得最多的,二叉查找树可以加速我们查找的效率,那么输出一个二叉树也变得尤为重要了. 二叉树的遍历方法分为三种,分别为前序遍历.中序遍历.后序遍历.下图即为一个二叉 ...
- bcnf范式
3.5范式--bcnf范式到底是什么呢? 对于bcnf范式,通过查阅资料,我的理解是--主键依赖的去除.比如说:一个仓库管理的表格,有以下属性(管理员编号,仓库号,货物编号,货物数量)其中每个管理员管 ...
- 利用matlab进行协方差运算
本文全部参考自: http://www.cnblogs.com/welen/articles/5535042.html#undefined 知识点一: MATLAB中四个取整函数具体使用方法如下:Ma ...