Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/anytv/anytv-node-quota
express middleware for api quota
https://github.com/anytv/anytv-node-quota
Last synced: 24 days ago
JSON representation
express middleware for api quota
- Host: GitHub
- URL: https://github.com/anytv/anytv-node-quota
- Owner: anyTV
- License: mit
- Created: 2015-11-12T04:59:26.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-01-11T01:23:06.000Z (almost 7 years ago)
- Last Synced: 2024-12-12T03:18:04.194Z (29 days ago)
- Language: JavaScript
- Size: 12.7 KB
- Stars: 0
- Watchers: 13
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/anyTV/anytv-node-quota.svg?branch=master)](https://travis-ci.org/anyTV/anytv-node-quota)
[![Dependency Status](https://david-dm.org/anyTV/anytv-node-quota.svg)](https://david-dm.org/anyTV/anytv-node-quota)
[![devDependency Status](https://david-dm.org/anyTV/anytv-node-quota/dev-status.svg)](https://david-dm.org/anyTV/anytv-node-quota#info=devDependencies)
[![Code Climate](https://codeclimate.com/github/anyTV/anytv-node-quota/badges/gpa.svg)](https://codeclimate.com/github/anyTV/anytv-node-quota)
AnyTV Middleware for Quota
=====#### Requirements
```
npm install anytv-node-quota --save
npm install anytv-node-mysql --save
```#### How to use
```javascript
// include packages
const quota = require('anytv-node-quota')
const mysql = require('anytv-node-mysql')....
// add db key 'accounts_db' to anytv-node-mysql
mysql.add('accounts_db', config.ACCOUNTS_DB)// create instance of quota store by passing anytv-node-mysql db instance
let quota_store = quota.store.create(mysql)
// create instance of quota middleware by passing (, , )
let quota_middleware = quota.middleware(quota_store, 'default', true)....
// use quota in your routes and controllers
router.get('/', (req, res) => {
// set endpoint weight
res.anytv_quota.set_weight(1)// some codes here
res.send({success: 'it is working.'})
})
```