Zonex999 commited on
Commit
ab6e343
·
verified ·
1 Parent(s): 1c9bfaf

Update server.js

Browse files
Files changed (1) hide show
  1. server.js +7 -4
server.js CHANGED
@@ -1,11 +1,14 @@
1
  const express = require('express');
2
  const app = express();
3
- const port = 3000;
 
 
4
 
5
  app.get('/', (req, res) => {
6
- res.send('test from js');
 
7
  });
8
 
9
- app.listen(port, '0.0.0.0', () => {
10
- console.log(`Express server running at http://0.0.0.0:${port}`);
11
  });
 
1
  const express = require('express');
2
  const app = express();
3
+ const PORT = process.env.PORT || 7860;
4
+
5
+ const startTime = Date.now();
6
 
7
  app.get('/', (req, res) => {
8
+ const uptimeSeconds = Math.floor((Date.now() - startTime) / 1000);
9
+ res.send(`I'm (from node yaaaa) alive for: ${uptimeSeconds} seconds`);
10
  });
11
 
12
+ app.listen(PORT, '0.0.0.0', () => {
13
+ console.log(` Server running on http://0.0.0.0:${PORT}`);
14
  });