fix: update Dockerfile and enhance article deletion route
- Changed the COPY command in Dockerfile to reference workers.json directly. - Added basic authentication middleware to the article deletion route for improved security.
This commit is contained in:
@@ -18,7 +18,7 @@ COPY middlewares/ ./middlewares/
|
|||||||
COPY routes/ ./routes/
|
COPY routes/ ./routes/
|
||||||
COPY services/ ./services/
|
COPY services/ ./services/
|
||||||
COPY utils/ ./utils/
|
COPY utils/ ./utils/
|
||||||
COPY ../../workers.json ./workers.json
|
COPY workers.json ./workers.json
|
||||||
|
|
||||||
# Exponer puerto
|
# Exponer puerto
|
||||||
EXPOSE 3001
|
EXPOSE 3001
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { basicAuthMiddleware } from '../middlewares/auth.js';
|
|||||||
|
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
|
|
||||||
router.delete('/', async (req, res) => {
|
router.delete('/', basicAuthMiddleware, async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const count = await clearAllArticles();
|
const count = await clearAllArticles();
|
||||||
res.json({ success: true, message: `Todos los artículos eliminados: ${count} artículos borrados`, count });
|
res.json({ success: true, message: `Todos los artículos eliminados: ${count} artículos borrados`, count });
|
||||||
|
|||||||
Reference in New Issue
Block a user