POST request to REST API

I am building an application similar to this. link to app. The API being used by this application is on Amazon AWS. This is a simple question and answer application based on answering the correct capital city of the country in the question.

i am struggling to receive the correct response when making a POST request to a mock REST API. json-server.

When a POST request is made to the Amazon API with this data, { country, city } where country is the country in the question and city is the user submitted city, the response to this request is {correct: true, correctAnswer: "St. John's", userAnswer: "St. John's"}. The API’s response shows that the API compared the user submitted answer with the correct answer and was able to true or false. How can I build something similar to this where the logic is handled by the API when a POST request is made? JavaScript cannot be written in JSON files which was my initial idea.