Application made with Laravel 8 that consists of the creation of a CRUD of a games api that contains the following functionalities:
- Relationships between different models with polymorphic tables.
- Contains endpoints of type GET, POST, PUT and DELETE
- Some endpoints contain the function of sending files and the files are stored locally.
- Implementation of API Dropbox in the dropbox branch the difference with the master branch is that in the dropbox branch it is configured so that the files that are sent through the api are saved in a shared Dropbox directory instead of a local directory of the project.
- Postman collection.json file to import and create use endpoints.
- Resource file to show the values of some endpoints in a personalized way.
- Requests validations.
- Exception handling.
- Migration file to create all the tables in the database.
- File seeder with +50 games to insert the data into the database.
- Seeders are in JSON format
- It is compatible with PHP 8
- Search filters of the games that are inserted in the database.
- Documentation of all the api enpoints with the Laravel Swagger 3.0.
- Users can be registered through the Api and it contains authentication by Sanctum to be able to carry out the action of some endpoints.
- The Api is uploaded in heroku https://laravelapijuegos.herokuapp.com so that users can use the endpoints without having to download the project.
- The project contains the files to deploy it in Docker.
- Demonstration of a Laravel project on the client interface side using this api https://github.com/JAVI-CC/Laravel-API-Client.
- Demonstration of a Quasar Framework project on the client interface side using this api https://github.com/JAVI-CC/Quasar-API-client.
https://laravelapijuegos.herokuapp.com
http://laravelapijuegos.herokuapp.com/api/documentation
https://github.com/JAVI-CC/Laravel-API-Client
https://github.com/JAVI-CC/Quasar-API-client
Key | Value |
---|---|
Authorization | {Token provided by Sanctum} |
Accept | application/json |
Content-Type | application/json |
$ composer install && php artisan key:generate && php artisan migrate --seed
Method | Path | Description | Auth |
---|---|---|---|
GET | /api/juegos | Get all the games | No |
POST | /api/juegos/ | Add a game | Yes |
GET | /api/juegos/{slug} | Get a game | No |
PUT | /api/juegos/edit | Update game without uploading the image | Yes |
POST | /api/juegos/edit | Update a game with the included image | Yes |
DELETE | /api/juegos/delete/{slug} | Delete a game | Yes |
POST | /api/juegos/filter/search | Search games | No |
GET | /api/juegos/desarrolladoras/{slug} | Get games from a developer | No |
GET | /api/juegos/generos/{slug} | Get games from a genere | No |
GET | /api/juegos/generos/show/all | Get list all generes | No |
GET | /api/juegos/paginate | Get paginate games | No |
GET | /api/juegos/random | Get random games | No |
Method | Path | Description | Auth |
---|---|---|---|
POST | /api/auth/register | Register a user | No |
POST | /api/auth/login | Login a user | No |
GET | /api/auth/userinfo | To view a user information | Yes |
POST | /api/auth/logout | Log out a user | Yes |
- nginx:alpine -
:8000->80/tcp
- mariadb:latest -
:3306
- php:8.0.6-fpm -
:9000
├── laravel-api-server-app ├── laravel-api-server-web └── laravel-api-server-db
$ git clone https://github.com/JAVI-CC/Laravel-API-Server.git
$ cd Laravel-API-Server
$ cp .env.example .env
$ docker-compose up -d
$ docker-compose exec --user=root app chmod -R 777 /var/www/
$ docker-compose exec app composer install
$ docker-compose exec app php artisan key:generate
$ docker-compose exec app php artisan migrate --seed
Once you have the containers deployed, you can access the API at http://localhost:8000