A barebones Node.js app using Express 4.
Make sure you have Node.js and the Heroku CLI installed.
$ git clone https://github.com/amilam/rest-service.git
$ cd rest-service
$ npm install express express-basic-auth
$ node index.js
Your app should now be running on localhost:5000. This is secured with following credentials. username: admin password: admin
If you try http://localhost:5000/hello?name=john you will not see anything in the browser because it is unauthorized. But, if you try with the following curl command you will get a response. curl -v -X GET -H "Authorization:Basic YWRtaW46YWRtaW4=" 'http://localhost:5000/hello?name=amila'
$ heroku create
$ git push heroku master
$ heroku open
or
For more information about using Node.js on Heroku, see these Dev Center articles: