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. 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();