Redirect to image after upload

This commit is contained in:
Ethanell 2020-04-26 19:15:53 +02:00
parent db7eabaa67
commit e30e92f9ce

5
app.js
View file

@ -69,10 +69,7 @@ app.use(morgan("dev"))
res.render("index"); res.render("index");
}) })
.post("/upload", isAuth, upload.single("image"), (req, res) => { .post("/upload", isAuth, upload.single("image"), (req, res) => {
if (req.body.image) { res.redirect("/images/" + req.file.filename);
fs.writeFile("images/", data, options, callback)
}
res.redirect("/");
}) })
.get("/login", (req, res) => { .get("/login", (req, res) => {
let fail = false; let fail = false;