
IP2 REST API
Motivation for the Project
During the Integrated Project 2 module at the university, my team have decide to make an Android application that will allow users to take quizzes, and through that learn about things they are interested in. To make it work, we had to create intermediate layer, between Android application and Database, which was hosted remotely on VPS. I came up with idea of creating RESTful API, that would act middleware between presentation and data layer. After explaining my team mates why this is a good idea, and why making direct SQL queries from application is a very idea, from security perspective to say the least, I started developing this API. I have decided to use Lumen, a microframework based on Laravel. I basically needed HTTP requests handler and ORM, therefore using full bodied Laravel was a bit overkill. During the development process, I have documented all endpoints on GitHub Wiki, which acted as self documentation of this system layer.
Technology Stack
- Lumen – a PHP microframework, based on Laravel. Allows handling HTTP requests and interact with Database out of the box
- Heroku Cloud – a Platform as a Service, which allowed to host the API in the cloud, without too much hassle with configuration or deployment
- Eloquent – a Laravel’s ORM, that interacted directly with database. Clean, easy to use and effective.
The Outcome
The RESTful API came out as core part of the system, and allowed for great flexibility and extendability of the system. Any endpoints that were required, could be added in a matter of minutes, and deployed to Heroku Cloud automatically, as it connects with GitHub repository and pull latest changes from chosen branch. The technology proved to be very useful and easy to use, I will definitely use it in the future. It also allowed me to learn more about REST APIs and how to build the properly.