/* -------------------------------------------
* Initialize Inspector with the Ingestion Key.
--------------------------------------------- */
const inspector = require('@inspector-apm/inspector-nodejs')({
ingestionKey: 'xxxxxxxxxxxxx682eedcce097b64b'
var http = require('http')
var patterns = require('patterns')()
// Setup routes and their respective route handlers
patterns.add('GET /posts/{id}', require('./routes/posts').show)
http.createServer(function (req, res) {
// Check if we have a route matching the incoming request
var match = patterns.match(req.method + ' ' + req.url);
// If no match is found, respond with a 404. Elastic APM will in
// this case use the default transaction name "unknown route"
// The patterns module exposes the pattern used to match the
// request on the `pattern` property, e.g. `GET /posts/{id}`
inspector.startTransaction(match.pattern)
req.params = match.params