express-once:创建只运行一次的快速中间件

时间:2021-07-02 08:00:04
【文件属性】:
文件名称:express-once:创建只运行一次的快速中间件
文件大小:5KB
文件格式:ZIP
更新时间:2021-07-02 08:00:04
JavaScript 表达一次 创建只运行一次的快速中间件。 曾经希望你可以制作一个每次请求只被调用一次的函数吗? 那么现在你可以once ! 简单地将您的函数包装once并根据需要将任意次数添加到您的应用程序中,并满足它只会被调用......一次。 var express = require ( 'express' ) , once = require ( 'express-once' ) ; var app = express ( ) ; // Ensure this function is only called once var hello = once ( function middleware ( req , res , next ) { console . log ( 'Hello world.' ) ; } ) ; // Try to call it many times... but
【文件预览】:
express-once-master
----.gitignore(36B)
----README.md(1KB)
----test()
--------helpers()
--------spec()
----.eslintrc(809B)
----package.json(1KB)
----.travis.yml(214B)
----.editorconfig(130B)
----lib()
--------once.js(640B)

网友评论