Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lqqyt2423/basic-auth
The basic auth middleware for express
https://github.com/lqqyt2423/basic-auth
Last synced: 20 days ago
JSON representation
The basic auth middleware for express
- Host: GitHub
- URL: https://github.com/lqqyt2423/basic-auth
- Owner: lqqyt2423
- License: mit
- Created: 2018-10-13T05:53:16.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-07-28T04:10:20.000Z (over 5 years ago)
- Last Synced: 2024-10-30T08:54:18.525Z (3 months ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# The basic auth middleware for express
## Install
```bash
npm install @liqiqiang/basic-auth --save
```## Usage
### before all route
```javascript
const express = require('express');
const basicAuth = require('@liqiqiang/basic-auth');const app = express();
// all route
app.use(basicAuth('user', 'password'));app.listen(8000);
```### before specific route
```javascript
const express = require('express');
const basicAuth = require('@liqiqiang/basic-auth');const app = express();
// specific route
app.use('/api', basicAuth('user', 'password'));app.listen(8000);
```