Skip to content

Instantly share code, notes, and snippets.

@pavinduLakshan
Created June 22, 2020 12:52
Show Gist options
  • Save pavinduLakshan/032da80132e880778817af239a79160e to your computer and use it in GitHub Desktop.
Save pavinduLakshan/032da80132e880778817af239a79160e to your computer and use it in GitHub Desktop.
var express = require("express");
var router = express.Router();
const multer = require("multer");
var upload = require("../upload");
router.post("/upload-image", (req, res, next) => {
let final_status = 200
upload(req, res, function(err) {
if (err instanceof multer.MulterError) {
console.log(err)
final_status = 500
} else if (err) {
console.log(err)
final_status = 500
}
var paths = req.files.map(file => file.path);
console.log("image path: "+paths[0])
});
});
module.exports = router;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment