In Express, I'm having trouble finding a way to prompt the user to enter a username/password when they hit a certain directory much like I could on an Apache server with htaccess and htpasswd. Below is some example code of where I'm trying to go with this.
app.get('/password-directory', function(req, res, next) {
if (user === 'username' && password === "setPassword') {
res.send(201);
} else res.send(403);
})
Is there any way to prompt the user when they hit mysite.com/password-directory for their credentials? Or even doing this username:password@mysite.com/password-directory?
I'm really only looking to protect a specific directory, it has some static files in it so I'm really looking for the most basic solution possible.
Thanks for any help and please let me know if I need to clarify anything!