This repository has been archived on 2025-11-04. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
qoverflow/server/routes/question/CreateQuestion.js

18 lines
471 B
JavaScript

async function CreateQuestion(req, res, next) {
const user = req.user;
const { title, text } = req.body;
if (!title || !text) {
return res.status(400).send('Your request is missing information.');
}
const { success } = await createRequest('post', `/questions`, {
creator: user,
title,
text,
});
return success ? res.send() : res.status(500).send('Something went wrong.');
}
module.exports = CreateQuestion;