Created
August 14, 2020 12:29
-
-
Save jairojunior/073f5aa210f154a10f1af69fec3e1e75 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express') | |
var multer = require('multer') | |
var upload = multer({ dest: 'uploads/' }) | |
var app = express() | |
app.post('/upload', upload.single('test'), function (req, res, next) { | |
console.log('File received...') | |
console.log(req.file, req.body) | |
try { | |
return res.status(201).json({ | |
message: 'File uploded successfully' | |
}); | |
} catch (error) { | |
console.error(error); | |
} | |
}) | |
app.listen(80, () => { | |
console.log('Server running...') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment