Question from the Node.js test

Given an express server, what are the correct statements about it?

Hard

Considering the following express server :

const path       = require('path');
const express    = require('express');
const bodyParser = require('body-parser');

let app          = express();
let messages     = [];

app.use('/message', bodyParser.urlencoded({extended:true}));
app.use('/message/add', express.static(path.join(__dirname, 'messagesViews')));

app.post('/message/add', (req, res) => {
  let { username, message } = req.body;
  messages.push({ username, message });

  res.send('Message posté !');
});

app.get('/message', (req, res) => {
  res.json(messages);
});

app.listen(1337);

What statement are true?

Author: Jean-marie CléryStatus: PublishedQuestion passed 871 times
Edit
0
Community Evaluations
developer avatar
Resat
27/05/2024
+1. Fini après lecture de première option. J'aurais coché 3 & 4 aussi autrement...
developer avatar
Thomas
10/01/2024
pas assez de temps pour lire la question puis toutes les réponses puis réfléchir