-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
38 lines (35 loc) · 984 Bytes
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const express = require("express");
const file_upload = require("express-fileupload");
const port = 3005;
const app = express();
app.post(
"/",
file_upload({
limits: { fileSize: 1 * 1024 * 1024 },
abortOnLimit: true,
}),
(req, res) => {
const arquivos = req.files;
arquivos.logo.mv(__dirname + "/FILES_ISAAC2/" + arquivos.logo.name, (e) =>
console.log(e)
);
// console.log(arquivos.logo);
res.status(202).send();
}
);
app.post("/1", file_upload(), (req, res) => {
const arquivos = req.files;
arquivos.logo.mv(__dirname + "/FILES_ISAAC2/" + arquivos.logo.name, (e) =>
console.log(e)
);
// console.log(arquivos.logo);
res.status(202).send();
});
app.get("/logo/download/:fileName", (req, res) => {
const fileName = req.params.fileName;
console.log(fileName);
res.download(__dirname + "/FILES_ISAAC2/" + fileName);
});
app.listen(port, () => {
console.log(`Example app listening at http://localhost:${port}`);
});