feat: download

- able to download file from express
This commit is contained in:
cv
2021-05-26 23:10:00 +02:00
parent 250946fdc6
commit b61a82627e
6 changed files with 63 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
// Create controller for GET request to '/ontime/download'
// Returns -
export const eventsDownload = async (req, res) => {
res.download('db.json', 'ontime events.json', (err) => {
if (err) {
res.status(500).send({
message: 'Could not download the file. ' + err,
});
}
});
};