Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function doServeFile(name, fullpath, res) {
- if (fullpath) {
- console.info("---try send file:" + fullpath);
- res.sendFile(fullpath);
- }else {
- res.status(404);
- }
- }
- router.get("/:id", function (req, res, next) {
- Model.findById(id).then(file=> {
- var fullPath = Config.uploadDest + "/" + file.path;
- doServeFile(file.filename, fullPath, res)
- }).catch(Util.dbErrorHandler);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement