middlewares.js 420 Bytes
import dotenv from "dotenv";
import multer from "multer";
import routes from "./routes";

dotenv.config();

const multerFile = multer({ dest: "uploads/files/" });

export const localsMiddleware = (req, res, next) => {
  res.locals.siteName = "my Storage";
  res.locals.routes = routes;
  next();
};

export const uploadFile = multerFile.single("file");
// single에 들어간 File은 upload.pug의 file 부분 input name