Skip to content

Commit 512a858

Browse files
committed
Fix : Static path - remove middleware
1 parent 7c1c798 commit 512a858

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

backend/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ async function startServer() {
5757
app.use('/api/email',authenticateUser, emailRoutes);
5858
app.use('/api/news',authenticateUser, newsRoutes);
5959
app.use('/api/discord',authenticateUser, discordRoutes);
60-
app.use("/api/uploads/imgnews", authenticateUser, express.static(path.join(__dirname, "/uploads/imgnews")));
60+
app.use("/api/uploads/imgnews", express.static(path.join(__dirname, "/uploads/imgnews")));
6161

6262
// Démarrage du serveur
6363
app.listen(server_port, () => {

backend/src/controllers/news.controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const createNews = async (req: Request, res: Response) => {
1515

1616
try {
1717

18-
const image_url = file ? `/uploads/imgnews/${file.filename}` : undefined;
18+
const image_url = file ? `/api/uploads/imgnews/${file.filename}` : undefined;
1919
const news = await news_service.createNews(
2020
title,
2121
description,
@@ -128,7 +128,7 @@ export const deleteNews = async (req: Request, res: Response) => {
128128
export const updateNews = async (req: Request, res: Response) => {
129129
const { id, title, description, type, target } = req.body;
130130
const file = req.file;
131-
const image_url = file ? `/uploads/imgnews/${file.filename}` : undefined;
131+
const image_url = file ? `/api/uploads/imgnews/${file.filename}` : undefined;
132132

133133
try {
134134
const existing = await news_service.getNewsById(Number(id));

0 commit comments

Comments
 (0)