diff options
author | Mark Powers <markppowers0@gmail.com> | 2019-11-08 22:08:21 -0600 |
---|---|---|
committer | Mark Powers <markppowers0@gmail.com> | 2019-11-08 22:08:21 -0600 |
commit | 298329e1bacee29f13a6a0349786a5b2b4343404 (patch) | |
tree | dd3cd44792bd82e1269c7a94891c6f6524fd2431 /src | |
parent | 569bec2aebc7788fa2ce6583f5f959231205c238 (diff) | |
parent | 22cf43731ccae151b1fddc80a47b30b8f943a481 (diff) |
Merge branch 'master' of https://github.com/Mark-Powers/marks.kitchen
Diffstat (limited to 'src')
-rw-r--r-- | src/server.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/server.js b/src/server.js index 1a5b3d2..3bfafa8 100644 --- a/src/server.js +++ b/src/server.js @@ -4,13 +4,14 @@ const cookieParser = require('cookie-parser'); const request = require('request'); const crypto = require('crypto'); const uuidv4 = require('uuid/v4'); +const path = require('path'); const Op = require('sequelize').Op; const multer = require('multer'); var storage = multer.diskStorage({ destination: function (req, file, cb) { - cb(null, 'src/uploads/') + cb(null, __dirname+'/uploads/') }, filename: function (req, file, cb) { var ext = ""; @@ -161,7 +162,7 @@ function setUpRoutes(models, jwtFunctions, database) { try { const type = req.body.type const newPost = await models.posts.create(req.body); - req.files.forEach(async (file) => { + req.files.forEach(async (file) => { await models.pictures.create({ "source": "uploads/" + file.filename, "postId": newPost.id }); console.log("uploaded ", file.path); }) |