first message command test

This commit is contained in:
Baipyrus 2023-01-16 15:21:30 +01:00
parent bb4f4642bf
commit 01709c890d

View File

@ -5,15 +5,17 @@ const express = require('express');
const app = express();
const clientPath = __dirname+'/../html';
console.log('Serving static from ' + clientPath);
app.use(express.json());
app.use(express.static(clientPath));
const server = http.createServer(app);
app.post('/message', (req, res) => {
res.status(200).send(req.body);
const { user, message } = req.body;
res.status(200).json({message});
});
server.on('error', err => {
console.error('Internal server error:', err);
console.error('Internal server error', err);
});
server.on('close', () => {