Vehicle inventory API for Fleet car rental.
Elijah De La Cruz Garcia
npm install
cp .env.example .env
npm start
Requires local MongoDB on 127.0.0.1:27017 (database: fleetDB). Server runs on the port set in .env (default 5000).
.env is required and is not committed to Git. Keys:
| Key | Purpose |
|---|---|
PORT |
Express port |
MONGO_URI |
MongoDB connection string |
JWT_SECRET |
Signing secret for auth tokens |
GET /api/vehicles- list all vehicles (200)POST /api/vehicles- add a vehicle (201); requests missinglicensePlateare rejected with 400 by validation middleware- Undefined URLs return 404; server errors are formatted as JSON by the global error handler
Requests are accepted from the Vite dev server at http://localhost:5173 and http://127.0.0.1:5173. Any other origin is rejected with 403 and receives no Access-Control-Allow-Origin header.
See INTEGRATION.md for the vite.config.js proxy configuration, the endpoint reference, and working fetch and axios examples.