https://github.com/lqqyt2423/basic-auth
The basic auth middleware for express
https://github.com/lqqyt2423/basic-auth
Last synced: 3 months 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 (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-07-28T04:10:20.000Z (almost 6 years ago)
- Last Synced: 2025-04-12T21:57:55.550Z (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);
```