API Express faire
const express = require('express')
const app = express()
const port = 3000
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.get('/users/name', (req, res) => {// users/name?name=Alex
return res.send(
`How are you ${req.query.name} !`,
); // How are you Alex
});
app.get('/users/:userId', (req, res) => {// users/Alex
return res.send(
`How are you ${req.params.name} !`,
);// How are you Alex
});
app.listen(port, () => {
console.log(`Example app listening at http://localhost:${port}`)
})
Pudochu