Modify the create function in the post controller to handle the request (request header: { Authorization: Bearer <token> }, request body: { "content": "" }) and check for any missing fields in the body.
Send the corresponding response back to the client:
return res.status(201).json({ status: 'success', data: content }) <for a successful request>return res.status(statusCode).json({ status: 'fail', error: "missing fields in body" }) <for a failed request>
User Story
As a user, so I can share my progress with others and take part in the community, I want to be able to make posts
Tasks
(request header: { Authorization: Bearer <token> }, request body: { "content": "" })
and check for any missing fields in the body.return res.status(201).json({ status: 'success', data: content }) <for a successful request>
return res.status(statusCode).json({ status: 'fail', error: "missing fields in body" }) <for a failed request>