mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-17 19:37:02 +00:00
improvement: moved public folder outside src
This commit is contained in:
4
backend/.gitignore
vendored
4
backend/.gitignore
vendored
@@ -1,4 +1,4 @@
|
||||
node_modules
|
||||
src/public/*
|
||||
!src/public/.gitkeep
|
||||
public/*
|
||||
!public/.gitkeep
|
||||
.env
|
||||
@@ -20,7 +20,7 @@ const app = express();
|
||||
|
||||
const fileStorage = multer.diskStorage({
|
||||
destination: (req, file, cb) => {
|
||||
cb(null, path.resolve(__dirname, "public"));
|
||||
cb(null, path.resolve(__dirname, "..", "public"));
|
||||
},
|
||||
filename: (req, file, cb) => {
|
||||
cb(null, new Date().getTime() + "-" + file.originalname.replace(/\s/g, ""));
|
||||
@@ -30,7 +30,7 @@ const fileStorage = multer.diskStorage({
|
||||
app.use(cors());
|
||||
app.use(express.json());
|
||||
app.use(multer({ storage: fileStorage }).single("media"));
|
||||
app.use("/public", express.static(path.join(__dirname, "public")));
|
||||
app.use("/public", express.static(path.join(__dirname, "..", "public")));
|
||||
|
||||
app.use("/auth", AuthRoutes);
|
||||
app.use(ContactsRoutes);
|
||||
|
||||
@@ -52,7 +52,7 @@ const handlMedia = async (msg, ticket) => {
|
||||
}
|
||||
|
||||
fs.writeFile(
|
||||
path.join(__dirname, "..", "public", media.filename),
|
||||
path.join(__dirname, "..", "..", "public", media.filename),
|
||||
media.data,
|
||||
"base64",
|
||||
err => {
|
||||
|
||||
Reference in New Issue
Block a user