Add web server for Heroku

This commit is contained in:
Rhys Arkins 2017-01-16 10:35:03 +01:00
parent 86f2e37ad7
commit 8f016c0856
2 changed files with 19 additions and 0 deletions

View file

@ -1 +1,2 @@
renovate: node renovate
web: node bin/heroku/web.js

18
bin/heroku/web.js Normal file
View file

@ -0,0 +1,18 @@
/* eslint-disable no-console */
const http = require('http');
const port = process.env.PORT || '3000';
const requestHandler = (request, response) => {
// Redirect users to Heroku dashboard
response.writeHead(302, { Location: 'https://dashboard.heroku.com/apps' });
response.end();
};
http.createServer(requestHandler).listen(port, (err) => {
if (err) {
console.log('Failed to start web server', err);
return;
}
console.log(`Web server is listening on ${port}`);
});