var http = require('http');
http.createServer(function handleReq(req, res) {
res.end('hello world');
}).listen(8080);
var TChannel = require('tchannel');
TChannel()
.register('hello', function handleReq(res, res) {
res.sendOk(null, 'hello world');
})
.listen(8080, '127.0.0.1')
Works on EC2 and locally
var ZeroConfig = require('zero-config');
var config = ZeroConfig(__dirname, {
dc: '/etc/uber/datacenter'
});
config.get('clients.ringpop.bootstrapFile')
config.get('port')
var Statsd = require('uber-statsd-client');
var statsd = Statsd({ host: 'localhost', port: 5555 });
statsd.increment('my-app.database-connection-died');
statsd.increment('my-app.no-drivers-available');
var Logtron = require('logtron');
var logger = Logtron({ meta: {
team: 'my-team',
project: 'my-app'
} });
logger.error('unexpected failure in fetching city', {
err: err,
cityId: cityId,
cityName: cityName
});
logger.warn('Got a bad response for city request', {
response: buffer.toString().slice(0, 50),
cityId: cityId,
cityName: cityName
});