I have this simple application that I created using IOS, this is a questionnaire application, whenever the user clicks the play button, he will call a request to node.js / express server


Technically, after the user clicks on the answer, he will move on to the next question

I am confused to use this method to get questions / question
- retrieves all the data in one go and presents it to the user - which is an array
- Retrieve data one by one as the user advances on the next issue - this is one information per call
API Examples
// Fetch all the data at once
app.get(‘/api/questions’, (req, res, next) => {
Question.find({}, (err, questions) => {
res.json(questions);
});
});
// Fetch the data one by one
app.get('/api/questions/:id', (req, res, next) => {
Question.findOne({ _id: req.params.id }, (err, question) => {
res.json(question);
});
});
1 , , , 200 , , mongodb , ,
2, , , api , mongodb .
Mongoose
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const QuestionSchema = new Schema({
question: String,
choice_1: String,
choice_2: String,
choice_3: String,
choice_4: String,
answer: String
});