-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconsumer.js
46 lines (33 loc) · 948 Bytes
/
consumer.js
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
41
42
43
44
45
46
'use strict';
var port = process.env.PORT || 3000;
var http = require('http');
var app = require('./consumer/app')();
var server = http.createServer(app);
module.exports = {
/**
* Starts the server on the given port
*/
start: function() {
server.listen(port, function() {
console.log('---------------------------------');
console.log('CONSUMER STARTED');
console.log(' - Port: ' + port);
console.log('---------------------------------');
});
},
/**
* Stops the server
*/
stop: function() {
server.close(function() {
console.log('');
console.log('---------------------------------');
console.log('CONSUMER STOPPED');
console.log('---------------------------------');
});
}
};
process.on('SIGINT', function() {
module.exports.stop();
});
module.exports.start();