-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTestServer.js
More file actions
40 lines (28 loc) · 903 Bytes
/
TestServer.js
File metadata and controls
40 lines (28 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
CloudGenix Controller SDK
(c) 2017 CloudGenix, Inc.
All Rights Reserved
https://www.cloudgenix.com
This SDK is released under the MIT license.
For support, please contact us on:
NetworkToCode Slack channel #cloudgenix: http://slack.networktocode.com
Email: developers@cloudgenix.com
*/
// Simple server to test if HTTP requests are received
//
var http = require('http');
var server = http.createServer().listen(3000);
server.on('request', function (req, res) {
console.log("Request received from: " + req.connection.remoteAddress);
var body = "";
req.on('data', function (data) {
body += data;
});
req.on('end', function () {
console.log(body);
res.writeHead(200, {'Content-Type': 'text/plain'});
res.write('Hello World\n');
res.end();
});
});
console.log('Listening on port 3000');