-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
27 lines (20 loc) · 589 Bytes
/
server.js
File metadata and controls
27 lines (20 loc) · 589 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
'use strict';
const express = require('express');
const os = require('os');
const app = express();
const port = 3000;
const version = process.env.VERSION || 'NOT_SET';
app.get('/', (req, res) => {
res.send(`<h1>Hello world from : ${os.hostname()} - App version ${version}<h1>`);
});
app.get('/exitWithError', function (req, res) {
res.send('Exit with Error');
process.exit(1);
});
app.get('/exitSuccess', function (req, res) {
res.send('Exit Successfully');
process.exit(0);
});
app.listen(port, () => {
console.log(`Server is running at http://localhost:${port}`);
});