diff --git a/controllers/answer.js b/controllers/answer.js index e26421f..598fe76 100644 --- a/controllers/answer.js +++ b/controllers/answer.js @@ -11,7 +11,7 @@ function AnswerController(db) { AnswerController.prototype.answer = function(request, reply) { try { - this.answerModel.answer() + this.answerModel.answer(); } catch (e) { reply(Boom.badRequest(e.message)); diff --git a/controllers/question.js b/controllers/question.js index a42cb7c..971a1bc 100644 --- a/controllers/question.js +++ b/controllers/question.js @@ -83,6 +83,10 @@ QuestionController.prototype.upload = function(request, reply) { }); var data = request.payload; + var dir = __dirname + "/../uploads"; + if (!fs.existsSync(dir)){ + fs.mkdirSync(dir); + } if (data.file) { var name = data.file.hapi.filename;