Serve JSON on a Specific Route challenge solution problem

I faced the some problem in this challenge.

my code :

it didn’t work i was searching the solution . it is the same . but why it didn’t work. I am confused. started searching more.

I found this solution which worked

I made a changes to my code

I used get method instead of use method
but actually both method worked in this challenge

but still don’t understand how it is worked.
someone explain more about this topic

@jwilkins.oboe can use help me with this

please post your actual code, not a screenshot when you ask for help
A difference I see is that in the first case message is not defined

1 Like

As mentioned, it doesn’t look like message was defined in the first screenshot.

But you could have just written it like this instead of creating a variable of message.

res.json({"message": "Hello json"})

I found a good stackoverflow answer giving in depth explanations of the two methods.

1 Like