Created
April 13, 2016 22:21
-
-
Save therebelrobot/5932e57c144aeeab7ba22e0ea772e65e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
var express = require('express') | |
var compress = require('compression') | |
var galileo = require('./lib') | |
var app = express() | |
app.use(galileo( | |
'6c73df3000e611e6bc5a1d6d1334cde5', // staging | |
// '56cf3d2140aedfa34b1c9989', // local | |
'default-environment', | |
{ | |
logBody: true, // LOG_BODY agent spec | |
failLog: './coverage', // FAIL_LOG agent spec | |
failLogName: 'galileo-agent-errors.log', // FAIL_LOG agent spec | |
limits: { | |
bodySize: 10000, // bytes | |
retry: 5, // RETRY_COUNT agent spec | |
retryTime: 1, // time in between retries | |
flush: 5, // seconds, FLUSH_TIMEOUT agent spec | |
connection: 30 // seconds, CONNECTION_TIMEOUT agent spec | |
}, | |
queue: { // QUEUE_SIZE agent spec | |
batch: 1, // number in a batch, if >1 switches path; `single` to `batch` | |
entries: 500 // number of entries per ALF record | |
}, | |
collector: { | |
host: 'galileo-collector.blah.com', // staging | |
// host: 'localhost', // staging | |
port: 58000, // PORT agent spec | |
path: '/1.1.0/single', | |
ssl: false | |
} | |
} | |
)) | |
// app.use(compress()) | |
app.get('/', function (req, res) { | |
res.sendStatus(200) | |
}) | |
app.get('/:var1', function (req, res) { | |
res.sendStatus(200) | |
}) | |
app.get('/:var1/:var2', function (req, res) { | |
res.sendStatus(200) | |
}) | |
app.get('/:var1/:var2/:var3', function (req, res) { | |
res.sendStatus(200) | |
}) | |
app.get('/:var1/:var2/:var3/:var4', function (req, res) { | |
res.sendStatus(200) | |
}) | |
app.post('/', function (req, res) { | |
res.sendStatus(200) | |
}) | |
app.post('/:var1', function (req, res) { | |
res.sendStatus(200) | |
}) | |
app.post('/:var1/:var2', function (req, res) { | |
res.sendStatus(200) | |
}) | |
app.post('/:var1/:var2/:var3', function (req, res) { | |
res.sendStatus(200) | |
}) | |
app.post('/:var1/:var2/:var3/:var4', function (req, res) { | |
res.sendStatus(200) | |
}) | |
app.delete('/', function (req, res) { | |
res.sendStatus(200) | |
}) | |
app.patch('/', function (req, res) { | |
res.sendStatus(200) | |
}) | |
app.listen(8888, function(){ | |
console.log('demo running on port 8888') | |
}) | |
// 'use strict' | |
// | |
// var http = require('http') | |
// | |
// var galileo = require('./lib') | |
// var agent = galileo('56cf3d2140aedfa34b1c9989', 'default-environment', { | |
// logBody: true, // LOG_BODY agent spec | |
// failLog: '/dev/null', // FAIL_LOG agent spec | |
// limits: { | |
// bodySize: 1000, // bytes | |
// retry: 0, // R ETRY_COUNT agent spec | |
// flush: 5, // seconds, FLUSH_TIMEOUT agent spec | |
// connection: 30 // seconds, CONNECTION_TIMEOUT agent spec | |
// }, | |
// queue: { // QUEUE_SIZE agent spec | |
// batch: 1, // number in a batch, if >1 switches path; `single` to `batch` | |
// entries: 2 // number of entries per ALF record | |
// }, | |
// collector: { | |
// host: 'localhost', // HOST agent spec | |
// port: 58000, // PORT agent spec | |
// path: '/1.1.0/single', | |
// ssl: false | |
// } | |
// }) | |
// | |
// var server = http.createServer(function (req, res) { | |
// agent(req, res) | |
// res.writeHead(200, {'Content-Type': 'text/plain'}) | |
// res.end('Hello World!') | |
// }) | |
// | |
// server.listen(8888) | |
// 'use strict' | |
// | |
// var restify = require('restify') | |
// var galileo = require('./lib') | |
// | |
// var server = restify.createServer() | |
// | |
// server.use(galileo('56cf3d2140aedfa34b1c9989', 'default-environment', { | |
// logBody: true, // LOG_BODY agent spec | |
// failLog: '/dev/null', // FAIL_LOG agent spec | |
// limits: { | |
// bodySize: 1000, // bytes | |
// retry: 0, // R ETRY_COUNT agent spec | |
// flush: 5, // seconds, FLUSH_TIMEOUT agent spec | |
// connection: 30 // seconds, CONNECTION_TIMEOUT agent spec | |
// }, | |
// queue: { // QUEUE_SIZE agent spec | |
// batch: 1, // number in a batch, if >1 switches path; `single` to `batch` | |
// entries: 2 // number of entries per ALF record | |
// }, | |
// collector: { | |
// host: 'localhost', // HOST agent spec | |
// port: 58000, // PORT agent spec | |
// path: '/1.1.0/single', | |
// ssl: false | |
// } | |
// })) | |
// | |
// server.get('/', function (req, res, next) { | |
// res.send('Hello World!') | |
// next() | |
// }) | |
// | |
// server.post('/', function (req, res, next) { | |
// res.send('Hello World!') | |
// next() | |
// }) | |
// | |
// server.listen(8888) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment