Add request logging
This commit is contained in:
parent
eef830d0f8
commit
6e72cdb889
6
index.js
6
index.js
|
@ -10,6 +10,12 @@ const ws_ = [];
|
|||
const app = express();
|
||||
app.set('trust proxy', true);
|
||||
|
||||
app.use((req, res, next) => {
|
||||
// Request logger for debugging
|
||||
console.log(`[${new Date().toLocaleString()}] ${req.method} ${req.path} from ${req.ip} with ${JSON.stringify(req.body)}`);
|
||||
next();
|
||||
});
|
||||
|
||||
app.put('/api/connect/:jobid', (req, res) => {
|
||||
var id = btoa(Crypto.randomBytes(10).toString('base64').slice(0, 10)).replaceAll("=", "");
|
||||
ws_[id] = {};
|
||||
|
|
Loading…
Reference in a new issue