I will demonstrate how to handle the basics of routing.
- View Offline
- [Narrator] First, we have to understand that a route…is simply a mapping of HTTP verb and a URL pattern…into the controllers, which actually do the work.…This defines which request we'll accept…and how we'll process them.…For example, in our Chatter application,…we'll need to allow users to retrieve messages…that have already been posted.…In this case, we need to have something…to support a get messages path,…and probably map that into a controller…that retrieves the messages.…If we leave the URL as the default messages,…we'll probably get all the messages.…
While that works when there only a handful of users,…that will cause major problems longer term.…Therefore, we'll likely need to add parameters,…such as message ID,…to make sure we only get the one we need at that time.…Notice that this limitation might come from…improving the user experience or from internal operations…that simply keep the servers online.…Anyway, this sort of change is simply…refinement of our routing, not a complete replacement.…In our hands-on portion,…
This course begins with a simple application specification and builds it one step at a time. Each chapter includes a key concept, with examples from other public APIs, and then shows how to build it yourself with Silex. Learn about URL routing, validating input, and generating response codes and hypermedia payloads. Like any project, the first implementation may be a little messy, but don't worry. The last chapter covers refactoring and what it takes to scale and support the API going forward.
- Understanding the project goals
- Adding authentication with Silex
- Using cross-framework and authentication middleware
- Creating a read-write API in Silex
- Uploading files via an API
- Adding file security
- Creating payloads and response codes in Silex
- Scaling your API