Define the contract
Write sample requests and responses before code. Decide required title/year, public identifiers, pagination, and error statuses.
aml test
aml routes
aml doctor --production
curl -H 'Accept: application/json' http://127.0.0.1:8910/api/moviesImplement the five operations
Implement index, show, store, update, destroy. Use Data transactions where several writes must succeed together.
Test from failure to success
Test unauthenticated, forbidden, invalid, absent, duplicate retry, rate-limited, and successful cases. Then run production diagnostics.
SUMMARY
What to remember
- An API is a documented HTTP and JSON contract.
- Request, controller, persistence, and resource have separate roles.
- Authentication proves identity; abilities decide permission.
- Idempotency, limits, CORS, and request IDs solve different problems.