-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
27 lines (22 loc) · 691 Bytes
/
server.js
File metadata and controls
27 lines (22 loc) · 691 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
var express = require('express');
var app = express();
app.get('/', function (req, res) {
res.send('Hello World');
})
app.get('/:input', function(req, res){
if (req.params.input[0] == 'b') {
if (req.params.input[1] == 'u') {
if (req.params.input[2] == 'g') {
// abort the program!
process.abort();
}
}
}
res.send('The id you specified is ' + req.params.input);
});
const port = process.env.PORT || 8081;
var server = app.listen(port, function () {
var host = server.address().address
var port = server.address().port
console.log("Example app listening at http://%s:%s", host, port)
})