first message command test
This commit is contained in:
parent
bb4f4642bf
commit
01709c890d
6
index.js
6
index.js
@ -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', () => {
|
||||
|
Loading…
Reference in New Issue
Block a user