Skip to content

[Bug]: GET /bulk-predict/template CSV template download is unreachable — backend/routes/bulkPredict.js is never mounted #1002

Description

@Rudra-clrscr

Bug Description

backend/controllers/bulkPredictController.js exports downloadBulkPredictTemplate, which generates a downloadable bulk_predict_template.csv. The only route wired to this controller is GET /bulk-predict/template in backend/routes/bulkPredict.js. That router file is never require'd or app.use()'d in backend/server.js, so the template-download feature has no live endpoint. The working bulk-upload flow users actually hit (POST /bulk-predict) lives in a different, already-mounted file (predictionRoutes.js), which has no equivalent template route — so there is currently no way to reach the template download at all.

Unmounted router: backend/routes/bulkPredict.js (entire file, L1–L29)
Dead controller export: backend/controllers/bulkPredictController.js (downloadBulkPredictTemplate, ~L150)
Confirmed missing from app: backend/server.js — no require('./routes/bulkPredict') anywhere, unlike predictionRoutes, emailIntegrationRoutes, imapRoutes, etc. (L35–L40, L263–L266)
The route that is live: backend/routes/predictionRoutes.js L520 (POST /bulk-predict), L609 (POST /bulk-predict/export) — no GET /bulk-predict/template here

Steps to Reproduce

  1. Confirm the router is never referenced in the app entrypoint:
   grep -n "bulkPredict" backend/server.js
   # (no output)
  1. Start the backend and request the template endpoint:
   curl -i http://localhost:5000/bulk-predict/template
   curl -i http://localhost:5000/api/bulk-predict/template
  1. Compare with the actually-registered bulk endpoints from predictionRoutes.js, which do respond:
   curl -i -X POST http://localhost:5000/bulk-predict -F "file=@test.csv"

Expected Behavior

GET /bulk-predict/template should return a downloadable CSV (Content-Disposition: attachment; filename="bulk_predict_template.csv") with the sample text,label header, so users know the expected format before uploading a bulk file.

Actual Behavior

Both http://localhost:5000/bulk-predict/template and http://localhost:5000/api/bulk-predict/template return 404 Not Found, while POST /bulk-predict works correctly via the separately-mounted predictionRoutes.js.

Screenshots

No response

Additional Information

No response

Metadata

Metadata

Assignees

Labels

SSoC26bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions