node-test/app.js

17 lines
416 B
JavaScript

const express = require('express');
const PORT = 8900;
const HOST = '0.0.0.0';
const instanceNumber = Math.floor(Math.random() * 101);
const app = express();
app.get('/', (req, res) => {
var ip = req.headers['x-forwarded-for'] || req.ip;
res.send(`node-test instance ${instanceNumber}, your IP: ${ip}`);
});
app.listen(PORT, HOST, () => {
console.log(`Server started on http://${HOST}:${PORT}`);
});