Skip to content

Latest commit

Β 

History

History
44 lines (31 loc) Β· 1.68 KB

File metadata and controls

44 lines (31 loc) Β· 1.68 KB

πŸ“‘ HackTheTrash API Reference

Base URL

  • Local (Express on port 4000): http://localhost:4000 β€” API routes are under /api/... (e.g. http://localhost:4000/api/reports).
  • Production (Vercel, same host as the site): https://your-deployment.vercel.app β€” use /api/... on that same origin (do not set NEXT_PUBLIC_API_URL so the web app uses relative URLs).

This document uses path suffixes like /reports; the full path is /api/reports (Express mounts routers under /api).

Reports

GET /reports

List all reports.

Response:

{ "reports": [ { "id": "...", "latitude": 45.46, "longitude": 9.19, "status": "reported", ... } ] }

GET /reports/:id

Get a single report.

POST /reports

Create a new report. multipart/form-data.

Field Type Required Notes
photos File[] βœ… up to 5 image files
latitude number βœ…
longitude number βœ…
severity string ❌ small / medium / large
description string ❌
tags JSON array ❌ e.g. ["Plastic","Hazardous"]
anonymous boolean ❌

PATCH /reports/:id/status

Update status (admin/moderator). JSON body: { "status": "verified" }.

Statuses: reported | verified | cleaning | cleaned | rejected

Auth (stub)

POST /auth/register

POST /auth/login