Help with -> Basic Node and Express - Implement a Root-Level Request Logger Middleware

Tell us what’s happening:
Can’t get my solution to pass :confused:
Been pretty stuck and confused on this series in general, but I hope it’ll make sense after revisiting after awhile like a lot of stuff has

var express = require('express');
var app = express();

console.log("Hello World")
 
app.get("/", function(req, res) {
  res.sendFile(__dirname + "/views/index.html");
});

app.use(express.static(__dirname + "/public"))

app.get("/json", (req, res) => {
  if (process.env.MESSAGE_STYLE === "uppercase") {
  return res.json({"message": "HELLO JSON"})
  } else {
    return res.json({"message": "Hello json"})
  }
});


app.use((req, res, next) => {
  console.log(req.method + " " + req.path + " - " + req.ip)
  next();
})

My browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36.

Challenge: Implement a Root-Level Request Logger Middleware

Link to the challenge:

your logger middleware should be above the routes defined

1 Like