芝麻web文件管理V1.00
编辑当前文件:/home/freeclou/app.optimyar.com/backend/node_modules/koa2-ratelimit/test.js
const mongoose = require('mongoose'); const MongodbStore = require('./src/MongodbStore'); async function test() { await mongoose.connect('mongodb://localhost:27017/koa2-ratelimit'); const store = new MongodbStore(mongoose.connection, { collectionName: 'ratelimits', // table to manage the middleware collectionAbuseName: 'ratelimitsabuses', // table to store the history of abuses in. }); await store.Ratelimits.deleteMany({ }); const data = await Promise.all([ await store.incr('test', { interval: 1000 }, 1), await store.incr('test', { interval: 1000 }, 1), await store.incr('test', { interval: 1000 }, 1), await store.incr('test', { interval: 1000 }, 1), await store.incr('test', { interval: 1000 }, 1), await store.incr('test', { interval: 1000 }, 1), ]); console.log(data); } test();