From f9b9a4106c1f1aa4818f9fe0fc44b70df1c53a51 Mon Sep 17 00:00:00 2001 From: Brian Emilius Date: Thu, 1 Oct 2020 15:34:03 +0200 Subject: [PATCH 1/2] test on local paths --- .env | 2 +- README.md | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.env b/.env index b2ab9f9..defece2 100644 --- a/.env +++ b/.env @@ -1,3 +1,3 @@ NODE_ENV="development" JWT_SECRET=kj3h45bl2k34jt23498570q9n8098354t7029358tyowie5uthw8475tyq98347ty834irhfoqi34uyt18 -APP_DOMAIN="http://localhost:4000" \ No newline at end of file +APP_DOMAIN="https://be-dyrevelfaerd.herokuapp.com" \ No newline at end of file diff --git a/README.md b/README.md index 1925822..a79cd19 100644 --- a/README.md +++ b/README.md @@ -14,3 +14,6 @@ npm start ## Documentation http://localhost:4000 + +## Configuration +Edit `.env` with the appropriate values for each variable. From de6c6919e6f7fdb932ebbc89ee347ae85519f3e1 Mon Sep 17 00:00:00 2001 From: Brian Emilius Date: Thu, 1 Oct 2020 17:33:42 +0200 Subject: [PATCH 2/2] test local paths --- controllers/asset.controller.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/controllers/asset.controller.js b/controllers/asset.controller.js index 97c27e5..30ee08a 100644 --- a/controllers/asset.controller.js +++ b/controllers/asset.controller.js @@ -37,10 +37,14 @@ async function getSingleAsset(req, res, next) { async function updateSingleAsset(req, res, next) { try { let asset = await Asset.findByPk(req.params.id); - asset.update({ - url: req.fields.url - }); - res.json(asset); + + if (asset) { + asset.url = req.fields.url; + asset.save(); + res.json(asset); + } else { + res.status(404).end(); + } } catch(error) { console.error(error); res.status(500).end();