Complete the code to get the client's IP address using Express.
app.get('/client-ip', (req, res) => { const clientIp = req.[1]; res.send(`Client IP is: ${clientIp}`); });
The req.ip property in Express gives the client's IP address.
Complete the code to get the hostname from the request in Express.
app.get('/host', (req, res) => { const hostName = req.[1]; res.send(`Hostname is: ${hostName}`); });
The req.hostname property gives the hostname from the request.
Fix the error in accessing the client's IP address in this Express route.
app.get('/fix-ip', (req, res) => { const clientIp = req.[1]; res.send(`IP: ${clientIp}`); });
req.ip is a property, not a function, so no parentheses are needed.
Fill both blanks to create a route that sends both IP and hostname.
app.get('/info', (req, res) => { const ip = req.[1]; const host = req.[2]; res.send(`IP: ${ip}, Hostname: ${host}`); });
Use req.ip for IP and req.hostname for hostname.
Fill all three blanks to log IP, hostname, and request method in Express.
app.use((req, res, next) => {
console.log('IP:', req.[1]);
console.log('Host:', req.[2]);
console.log('Method:', req.[3]);
next();
});Use req.ip for IP, req.hostname for hostname, and req.method for HTTP method.
