在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:gevorg/http-auth开源软件地址:https://github.com/gevorg/http-auth开源编程语言:JavaScript 100.0%开源软件介绍:http-authNode.js package for HTTP basic and digest access authentication. InstallationVia git (or downloaded tarball): $ git clone git://github.com/gevorg/http-auth.git Via npm: $ npm install http-auth Usage// HTTP module
const http = require("http");
// Authentication module.
const auth = require("http-auth");
const basic = auth.basic({
realm: "Simon Area.",
file: __dirname + "/../data/users.htpasswd" // gevorg:gpass, Sarah:testpass
});
// Creating new HTTP server.
http
.createServer(
basic.check((req, res) => {
res.end(`Welcome to private area - ${req.user}!`);
})
)
.listen(1337, () => {
// Log URL.
console.log("Server running at http://127.0.0.1:1337/");
}); Please check examples directory for more. Configurations
Running testsIt uses mocha, so just run following command in package directory: $ npm test QuestionsYou can also use stackoverflow to ask questions using http-auth tag. Utilities
IntegrationsPlease check this link for integration packages. LicenseThe MIT License (MIT) |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论