Small Express API that connects to MongoDB Atlas and provides basic CRUD for a cards collection.
Setup
- Copy .env.exampleto.envand fill inMONGODB_URIand other values.
- From the mongodb_apifolder install dependencies:
npm installRun
npm start
# or for development with auto-reload
npm run devEndpoints
- GET /health — health check
- GET /cards?limit=100 — list cards (optional limit)
- GET /cards/:id — get card by ObjectId
- POST /cards — insert a card (JSON body) or array of cards
- DELETE /cards — delete all cards (clear all records)
Additional endpoint:
- GET /cardinfo — filter cards using query parameters similar to the ygoprodeck API. Returns JSON in the shape: { data: [ ... ] }
Examples:
- Get all cards (limit 100 by default):
- GET /cardinfo
 
- Get a card by exact name:
- GET /cardinfo?name=Dark%20Magician
 
- Fuzzy name search:
- GET /cardinfo?fname=Magician
 
- Archetype search:
- GET /cardinfo?archetype=Blue-Eyes
 
- Numeric comparisons (atk less than 2500):
- GET /cardinfo?atk=lt2500
 
Notes:
- The endpoint implements a subset of parameters: name, fname, id, konami_id, type, atk, def, level, race, attribute, link, linkmarker, scale, cardset, archetype, staple, has_effect, sort, limit.
- linkmarker matching is case-insensitive; multiple markers can be comma-separated and will be matched using $all.
Notes
- The delete-all endpoint performs a deleteMany({}) and will remove all documents from cardscollection. Use with caution.