Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed get flag answers endpoint to post #54

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gatewayservice/gateway-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ app.get('/flags/question', async (req, res) => {
}
});

app.get('/flags/answer', async (req, res) => {
app.post('/flags/answer', async (req, res) => {
try {
// Forward the request to the question service
const questionResponse = await axios.get(questionServiceUrl+'/flags/answer', req.body);
const questionResponse = await axios.post(questionServiceUrl+'/flags/answer', req.body);
res.json(questionResponse.data);
} catch (error) {
res.status(error.response.status).json({ error: error.response.data.error });
Expand Down
2 changes: 1 addition & 1 deletion questionservice/question-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ app.get('/flags/question', async (req, res) => {
* or not "false". In case it was incorrect, the chosen
* country will be returned as well
*/
app.get('/flags/answer', (req, res) => {
app.post('/flags/answer', (req, res) => {
const answeredFlag = req.body
console.log(answeredFlag);
console.log(correctAnswerFlag);
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/Question.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const Question = () => {
const answerQuestion = async (answer) => {
try {
setLoading(true);
const result = await axios.get(`${apiEndpoint}/flags/answer`, {answer}); // to fix
const result = await axios.post(`${apiEndpoint}/flags/answer`, answer);

const res = await axios.get(`${apiEndpoint}/flags/question`);
setQuestion(res.data);
Expand Down
Loading