Created
January 15, 2018 10:30
-
-
Save TinyExplosions/04c374bb5421867c2ab7a4bf899cc138 to your computer and use it in GitHub Desktop.
This file contains 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
require("appdynamics").profile({ | |
controllerHostName: '<CONTROLLER URI>', | |
controllerPort: 443, | |
controllerSslEnabled: true, | |
accountName: '<ACCOUNT>', | |
accountAccessKey: '<KEY>', | |
applicationName: '<APP NAME>', | |
tierName: '<TIER NAME>', | |
nodeName: '<NODE NAME>' | |
}); | |
var express = require('express'); | |
var cors = require('cors'); | |
var bodyParser = require('body-parser'); | |
var app = express(); | |
app.use(bodyParser.urlencoded({ | |
extended: true | |
})); | |
app.use(bodyParser.json()); | |
app.get('/hello', function(req, res) { | |
console.log(new Date(), 'In hello route GET / req.query=', req.query); | |
var world = req.query && req.query.hello ? req.query.hello : 'World'; | |
res.json({ msg: 'Hello ' + world }); | |
}); | |
app.post('/hello', function(req, res) { | |
console.log(new Date(), 'In hello route POST / req.body=', req.body); | |
var world = req.body && req.body.hello ? req.body.hello : 'World'; | |
res.json({ msg: 'Hello ' + world }); | |
}); | |
var port = process.env.FH_PORT || process.env.OPENSHIFT_NODEJS_PORT || 8001; | |
var host = process.env.OPENSHIFT_NODEJS_IP || '0.0.0.0'; | |
app.listen(port, host, function() { | |
console.log("App started at: " + new Date() + " on port: " + port); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment