Ottergram

Our favorite otters are back, this time with the hint can you edit comments

Normally I don't read the hint right away, but, busy day, busy life and all other excuses I can find, will be used to defend my choice to do it different today ⚔️

So because of the hint I obviously placed a comment at the first cute otter I saw.

When I went back to see all the other comments, I noticed that GET /api/posts/1/comments was kinda 'chatty'.

So now I tried editing a comment by just changing the HTTP-verb from GET to PUT . And I tried changing someone else's comment right away. Busy life, no time, headache and a bunch of other excuses ⚔️.

Unfortunately, no luck. Maybe I could just use POST and not change the id of the original post. Maybe that would overwrite it.

But the response came back with a different id, so I kinda already knew that wasn't what I needed. 😞.

Ok, let's now assume that editing is already implemented in the backend, but not yet on the frontend. If I were to make an REST endpoint, it would be PUT /api/posts/:postID/comments/:commentID, so why not try that?

Ok, that seems like that worked! Let's go to the frontend and check if otters are, in fact, so boring 😑

Seems like the admin has something against otters! But don't mind if I take my flag! 🇧🇪

Last updated