Modified search
This commit is contained in:
parent
55514b408b
commit
019877db9d
1 changed files with 4 additions and 7 deletions
|
|
@ -1,14 +1,11 @@
|
|||
const createRequest = require('server/utils/api');
|
||||
const config = require('server/config.json');
|
||||
|
||||
const Question = require('server/db/models/Question');
|
||||
|
||||
async function Search(req, res) {
|
||||
const { success, questions } = await createRequest(
|
||||
'get',
|
||||
`/questions/search`,
|
||||
req.query
|
||||
);
|
||||
const { match, regexMatch, sort } = req.query;
|
||||
|
||||
const questions = await Question.find({});
|
||||
|
||||
if (!success) return res.status(500).send(config.errorGeneric);
|
||||
|
||||
|
|
@ -26,7 +23,7 @@ async function Search(req, res) {
|
|||
})
|
||||
);
|
||||
|
||||
return res.send({ questions: questionSet.filter(question => question) });
|
||||
return res.send({ questions: questionSet.filter((question) => question) });
|
||||
}
|
||||
|
||||
module.exports = Search;
|
||||
|
|
|
|||
Reference in a new issue