Skip to content

Commit 10c3741

Browse files
add logging to upload
1 parent dd67d2f commit 10c3741

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

backend/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const server = require('http').createServer(app)
2323

2424
app.listen(3100, () => {
2525
logger.info('Grappa app listening on port 3100!')
26-
logger.info('Debugging version: 0.0.3')
26+
logger.info('Debugging version: 0.0.4')
2727
logger.info(`Environment is ${process.env.NODE_ENV}`)
2828
})
2929

backend/src/middleware/attachments.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import multer from 'multer'
33
const PATH_TO_FOLDER = '/usr/src/app/uploads/'
44

55
const storage = () => {
6+
console.log("Storage starting")
67
try {
78
if (process.env.NODE_ENV === 'test') {
89
return multer.memoryStorage()
@@ -11,16 +12,25 @@ const storage = () => {
1112
destination: PATH_TO_FOLDER
1213
})
1314
} catch (e) {
14-
console.log("storage method failed. Error starting from next line")
15+
console.log("storage failed. Error starting from next line")
1516
console.log(e)
1617
throw e
1718
}
1819
}
1920

20-
const upload = multer({ storage: storage() }).fields([
21+
const upload = () => {
22+
console.log("Starting upload")
23+
try {
24+
multer({ storage: storage() }).fields([
2125
{ name: 'otherFile' },
2226
{ name: 'reviewFile', maxCount: 1 },
2327
{ name: 'thesisFile', maxCount: 1 }
2428
])
29+
} catch (e) {
30+
console.log("Upload failed. Error: ")
31+
console.log(e)
32+
throw e
33+
}
34+
}
2535

2636
module.exports = upload

0 commit comments

Comments
 (0)