Skip to content
Snippets Groups Projects
Commit 3e0ea858 authored by Alexandru Munteanu's avatar Alexandru Munteanu
Browse files

Merge branch 'faraday-master' of gitlab.coko.foundation:xpub/xpub into faraday-master

parents dd091ed3 eec4a82c
No related branches found
No related tags found
No related merge requests found
...@@ -40,7 +40,7 @@ const AWSBackend = app => { ...@@ -40,7 +40,7 @@ const AWSBackend = app => {
s3.getSignedUrl('getObject', params, (err, data) => { s3.getSignedUrl('getObject', params, (err, data) => {
if (err) { if (err) {
res.status(400).json({ error: err }) res.status(err.statusCode).json({ error: err.message })
return return
} }
res.status(200).json({ res.status(200).json({
...@@ -52,6 +52,19 @@ const AWSBackend = app => { ...@@ -52,6 +52,19 @@ const AWSBackend = app => {
}) })
}, },
) )
app.delete('/api/aws-delete/:fileId', authBearer, async (req, res) => {
const params = {
Bucket: process.env.AWS_BUCKET,
Key: req.params.fileId,
}
s3.deleteObject(params, (err, data) => {
if (err) {
res.status(err.statusCode).json({ error: err.message })
return
}
res.status(200).json()
})
})
} }
module.exports = AWSBackend module.exports = AWSBackend
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment