npm i @g4br13l/basic-auth
const router = express.Router();
const BasicAuth = require("@g4br13l/basic-auth");
const newBasicAuth = new BasicAuth("testUser", "testPassword");
router.get("/test", newBasicAuth.protect, (req, res, next) => res.status(200).send());
module.exports = router;
StatusCode: 200
Sends next() to express
StatusCode: 401
{
"message": "Invalid Authentication Credentials"
}
StatusCode: 401
{
"message": "Missing Authorization Header"
}