Implement a Root-Level Request Logger Middleware

I didn’t find any correct answer for the error I got in my Implement a Root-Level Request Logger Middleware so here is the solution.

const logger = (req, res, next) => {
  console.log(`${req.method} ${req.path} - ${req.ip}`);

app.get("/", logger, (req, res) => {
app.get("/json", logger, (req, res) => {
  if (process.env.MESSAGE_STYLE === "uppercase")
      message: "Hello json".toUpperCase()
      message: "Hello json"

Welcome there,

If you have a question about a specific challenge as it relates to your written code for that challenge, just click the Ask for Help button located on the challenge.
This button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Also, please add information to your post body. Currently, we do not know what you are struggling with.

Thank you.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.