We just launched the API Tips, Tricks and Gotchas chapter. This is available to all book buyers at no extra charge!
This chapter consists of common issues and scenarios that come up when developing an API and how to solve them. Doing an API driven application flows a little bit differently than a monolith. In this chapter we go over:
Using PHPUnit to test your API ensures the application’s integrity. The chapter goes through a few specific functions built into Laravel geared towards API testing. Some test cases we cover are:
- Submitting data to endpoints
- Ensuring the endpoint returns the right response code
- Created data is stored correctly in the database
Both Postman (https://www.postman.com/) and Insomnia (https://insomnia.rest/) are essential tools to help you document and test your API. They allow you to save and document your endpoints for testing along with share that data with others. We touch on the basics of using both!
CORS (Cross-Origin Resource Sharing) can be a nightmare! In this chapter, we go through the configuration file that comes with Laravel and explain the settings, how we’d implement them, and what benefits the settings provide. No more CORS nightmares!
We also cover:
- Handling imperfect RESTful Routes
- Benefits of API versioning
- Securing sensitive data
Overall, this is one of the most beneficial chapters since it helps you to wrap your mind around some of the caveats of developing an API.
Coming up next are two quick tutorials about the Single Page Application side and a whole bunch of videos!
We’re really excited to show you some of the processes through video.
If you have any questions, or need any information, feel free to respond to this email or add your comment on our community.
Jay & Dan