10000 GitHub - JAVI-CC/Laravel-API-Server at 4aa9afc0bf09410cb79118113c175083a35a50bc
[go: up one dir, main page]

Skip to content

JAVI-CC/Laravel-API-Server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Total Downloads Latest Stable Version License

Application made with Laravel 10 that consists of the creation of a CRUD of a games api that contains the following functionalities:

< 8000 ul dir="auto">
  • 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.
  • 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.
  • Demo API

    https://laravel-api-server.up.railway.app

    Documentation API SWAGGER 3.0

    http://laravel-api-server.up.railway.app/api/documentation

    Laravel Api client interface

    https://github.com/JAVI-CC/Laravel-API-Client

    VUE 3 and Quasar Framework Api client interface

    https://github.com/JAVI-CC/VUE3-API-client

    Headers

    Key Value
    Authorization {Token provided by Sanctum}
    Accept application/json
    Content-Type application/json

    Setup

    $ composer install && php artisan key:generate && php artisan migrate --seed
    

    Endpoints Games:

    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

    Endpoints User:

    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

    Start the websockets with Pusher (Optional)

    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}
    

    Deploy to Docker 🐳

    Containers:

    • nginx:alpine - :8000->80/tcp
    • mariadb:latest - :3306
    • php:8.0.6-fpm - :9000

    Containers structure:

    ├── laravel-api-server-app
    ├── laravel-api-server-web
    └── laravel-api-server-db

    Setup:

    $ 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

    0