Merge pull request #2 from BrianEmilius/local-paths

Local paths
This commit is contained in:
Brian Emilius
2020-10-01 17:37:52 +02:00
committed by GitHub
3 changed files with 12 additions and 5 deletions

2
.env
View File

@@ -1,3 +1,3 @@
NODE_ENV="development"
JWT_SECRET=kj3h45bl2k34jt23498570q9n8098354t7029358tyowie5uthw8475tyq98347ty834irhfoqi34uyt18
APP_DOMAIN="http://localhost:4000"
APP_DOMAIN="https://be-dyrevelfaerd.herokuapp.com"

View File

@@ -14,3 +14,6 @@ npm start
## Documentation
http://localhost:4000
## Configuration
Edit `.env` with the appropriate values for each variable.

View File

@@ -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
});
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();