TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/vanegasjoseignacio2-cyber/Eco-It/llms.txt
Use this file to discover all available pages before exploring further.
/api/map router exposes a single public endpoint that serves recycling collection point data for the Eco-It interactive Leaflet map. No authentication is required — the map is visible to all visitors of the platform. Only points that are both active (activo: true) and marked as user-visible (visibleToUser: true) are returned; internal or deactivated points are always excluded from this response.
GET /api/map/points
Returns an array of processed recycling collection points, sorted from most recently created to oldest. Each object contains the geographic coordinates and descriptive metadata needed to render a marker on the map.
Authentication: Not required.
Request body: None.
Query parameters: None.
Response
true on a successful query.Array of recycling point objects. Empty array (
[]) if no active, visible points exist.MongoDB
_id of the recycling point document.Display name of the collection point, shown in the Leaflet popup. Required field — always present.
Category of the collection point. Determines the map marker icon. One of:
| Value | Description |
|---|---|
"recycling" | General recycling point |
"ecobottle" | Eco-bottle / plastic bottle deposit |
"truck" | Mobile recycling truck stop |
"container" | Large recycling container |
"green_zone" | Green zone / environmental area |
Latitude of the point in decimal degrees (WGS 84). Required.
Longitude of the point in decimal degrees (WGS 84). Required.
Cloudinary HTTPS URL of the point’s photo. Empty string (
"") if no image has been uploaded.Short description of the collection point, shown in the map popup body. Empty string if not provided.
Using the data with Leaflet
Thelat and lng fields map directly to Leaflet’s [lat, lng] coordinate format. Use the tipo field to select a custom marker icon per category.
Real-time updates via Socket.IO
When an admin creates, updates, deletes, or toggles a collection point, the server emits amap:updated event over Socket.IO with a fresh snapshot of all active, visible points. Subscribe to this event to keep the map in sync without polling.
PuntoReciclaje schema reference
The following table documents every field of the underlying PuntoReciclaje Mongoose model. The public endpoint returns only the subset listed in the response above.
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
_id | ObjectId | — | auto | MongoDB document ID |
nombre | String | ✅ | — | Display name |
tipo | String (enum) | ✅ | "recycling" | See type table above |
lat | Number | ✅ | — | WGS 84 latitude |
lng | Number | ✅ | — | WGS 84 longitude |
descripcion | String | ❌ | "" | Popup body text |
imagen | String | ❌ | "" | Cloudinary URL |
activo | Boolean | ❌ | true | Hidden from public if false |
visibleToUser | Boolean | ❌ | true | Hidden from public if false |
createdAt | Date | — | auto | Mongoose timestamp |
updatedAt | Date | — | auto | Mongoose timestamp |
Full CRUD management of collection points (create, update, delete, toggle active state) is available exclusively to administrators at
/api/admin/map/points. These admin endpoints require a JWT with rol: "admin" or rol: "superadmin" and are not part of the public API surface.Error reference
| HTTP Status | Cause |
|---|---|
500 | Database query failure; internal server error |