prepare log over HTTP

This commit is contained in:
Dobromir Popov 2024-02-16 20:29:39 +02:00
parent 9435650d4f
commit 643d3dfb6f
2 changed files with 14 additions and 1 deletions

7
.vscode/tasks.json vendored
View File

@ -41,6 +41,13 @@
"problemMatcher": [],
"label": "npm: start",
"detail": "node /app/web/server.js"
},
{
"type": "python",
"script": "start:tele",
"problemMatcher": [],
"label": "npm: start:tele",
"detail": "python agent-py-bot/agent.py"
}
]
}

View File

@ -118,6 +118,12 @@ app.get('/', (req, res) => {
res.sendFile(path.join(__dirname, 'client.html'));
});
//accept LOG messages on /log
app.post('/log', (req, res) => {
console.log(req.body.message);
res.send('OK', 200, { 'Content-Type': 'text/plain' });
});
//get WS url from .env file
app.get('/wsurl', (req, res) => {
@ -228,5 +234,5 @@ app.get('/test_ocr', (req, res) => {
app.listen(process.env.SERVER_PORT_HTTP, () => {
console.log('Server listening on port ' + process.env.SERVER_PORT_HTTP + ': http://localhost:' + process.env.SERVER_PORT_HTTP + '/');
console.log('Server listening on port ' + process.env.SERVER_PORT_HTTP);
});