Skip to content
Snippets Groups Projects
Commit eec4a82c authored by Sebastian's avatar Sebastian
Browse files

added delete endpoint

parent c1295987
No related branches found
No related tags found
No related merge requests found
......@@ -40,7 +40,7 @@ const AWSBackend = app => {
s3.getSignedUrl('getObject', params, (err, data) => {
if (err) {
res.status(400).json({ error: err })
res.status(err.statusCode).json({ error: err.message })
return
}
res.status(200).json({
......@@ -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
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