Skip to content

Commit

Permalink
Undo changes so is up to master
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcosBarrilVillaverde committed May 1, 2024
1 parent 650a7ac commit bc2e739
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ function validateFields(query) {
app.get('/questions', async (req, res) => {
try {


const { preguntas, respuestas, temas } = validateFields(req.query);
try {
const retQuestions = await QuestionGenerator.generateQuestions(preguntas, respuestas, temas);
Expand Down Expand Up @@ -79,6 +78,17 @@ app.get('/topics', async (req, res) => {
}
});

// Route for getting topics for questions
app.get('/topics', async (req, res) => {
try {
const topics = QuestionGenerator.getAvailableTopics();
res.send(topics);
} catch (error) {
console.error(`An error occurred: ${error.message}`);
res.status(500).json({ error: 'Internal Server Error' });
}
});

app.use((err, req, res, next) => {
console.error(`An error occurred: ${err}`);
res.status(500).send(`An error occurred: ${err.message}`);
Expand All @@ -94,4 +104,4 @@ server.on('close', () => {
mongoose.connection.close();
});

module.exports = server
module.exports = server

0 comments on commit bc2e739

Please sign in to comment.