I'm currently developing a RESTful web service with NodeJS and restify.
I have everything up and running with node-mysql for the database, but I also would like to implement HTTP Basic authentication.
I only did this once with Apache and an .htaccess
file.
But here the webserver comes with restify and I start it like this:
var server = restify.createServer({
name: 'my webservice'
});
There is a Authentication Parser Plugin listed in the restify documentation (http://mcavage.me/node-restify/#Bundled-Plugins) but I can't figure out how to use it.
The req.username
value is always set to anonymous, even when I use http://user:pass@url...
.
The best thing would be if I could use it with a .htpasswd
file to store/access the user and pass.
Does anyone know how to implement this with restify or another module?