Application made with Laravel 10 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.
- Feature testing.
- Factories.
- Traits.
- 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.
- Websockets with Pusher.
- 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 railway https://laravel-api-server.up.railway.app 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 VUE 3 and Quasar Framework project on the client interface side using this api https://github.com/JAVI-CC/VUE3-API-client.
https://laravel-api-server.up.railway.app
http://laravel-api-server.up.railway.app/api/documentation
https://github.com/JAVI-CC/Laravel-API-Client
https://github.com/JAVI-CC/VUE3-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 |
POST | /api/juegos/edit | Update a game | 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/desarrolladoras/show/all | Get list all developers | 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 |
GET | /api/auth/check | Check if user authenticated | No |
POST | /api/auth/logout | Log out a user | Yes |
DELETE | /api/auth/delete | Delete user authenticated | Yes |
1. In your Pusher account create a channel called: juegos-api
2. Enter the file: .env
3. fill in the following credentials:
PUSHER_APP_ID={App Keys in the channel juegos-api app_id}
PUSHER_APP_KEY={App Keys in the channel juegos-api key}
PUSHER_APP_SECRET={App Keys in the channel juegos-api secret}
PUSHER_APP_CLUSTER={App Keys in the channel juegos-api cluster}
- nginx:alpine -
:8000->80/tcp
- mariadb:11.2.2 -
:3306
- php:8.2.13-fpm -
:9000
├── laravel-server-juegos-api-app ├── laravel-server-juegos-api-web └── laravel-server-juegos-api-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 app chmod -R 777 /var/www/storage
$ docker-compose exec app php artisan key:generate
$ docker-compose exec app php artisan migrate --seed
$ docker-compose exec app php artisan test
In case you are using your IDE to develop the application and it odes not detect the files it contains within the vendor folder, you have to copy the files from the vendor folder of the container to the host machine with the following command.
$ docker compose cp app:/var/www/vendor .
Once you have the containers deployed, you can access the API at http://localhost:8000