Public Repository

Last pushed: 2 years ago
Short Description
Very simple service to test nodejs app
Full Description

Dockerfile

FROM google/nodejs

RUN mkdir /var/www/
ADD serviceleo.js /var/www/serviceleo.js
WORKDIR /var/www/

CMD ["node", "serviceleo.js"]

serviceleo.js

var http = require('http');
var url = require('url');

http.createServer(function (req, res) {
reqUrl = url.parse(req.url, true);

res.useChunkedEncodingByDefault = false;
res.writeHead(200, {'Content-Type': 'text/html'});

if (reqUrl.pathname == '/_ah/health') {
res.end('ok');
} else if (reqUrl.pathname == '/exit') {
process.exit(-1)
} else {
var msg = reqUrl.query['msg']
res.end('>> message is: ' + msg + ' at: ' + new Date() );
}

}).listen(8080, '0.0.0.0');

console.log('>>> Server running at http://127.0.0.1:8080/');

Docker Pull Command
Owner
leonardoanalista

Comments (0)