Build HTTP APIs with routing, middleware, validation, controllers, and error handling.
Lessons
Accept and verify incoming webhook events safely.
Receiving Webhooks is easiest to learn by reading the example, changing it, and observing the result.
// npm install axios
import express from 'express';
import axios from 'axios';
const app = express();
app.get('/api/weather/:city', async (req, res, next) => {
try {
const { data } = await axios.get('https://api.example.com/weather', {
params: { city: req.params.city },
timeout: 5000
});
res.json(data);
} catch (error) {
next(error);
}
});
app.listen(3000);Practice the Receiving Webhooks example in a small scratch file, then explain what changed and why.