diff --git a/index.js b/index.js index f2be829..636f831 100644 --- a/index.js +++ b/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', () => {