JoseCorreaMorales / jim-rest

App server-side

Home Page:https://jim-rest-production.up.railway.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lumen PHP Framework

Technologies used

Postman Icon JWT Icon PHP Icon Laravel Icon JSON Icon Lumen Icon REST API Icon MySQL Icon

Usage 📑

Create an environment variable file

cp .env.example .env

And fill the variables with your own data

Install dependencies

composer install

Start the server

php -S localhost:8000 -t public

Routes

  • GET /login: Requeries a username and password and returns a JWT token

Routes inside middleware (Protected routes)

  • /prodcuts

each route has the following methods:

  • Index: GET /route
  • Show: GET /route/{id}
  • Store: POST /route
  • Update: PUT /route/{id}
  • Destroy: DELETE /route/{id}

Login example

  1. Go to the login route
http://localhost:8000/login
  1. In postman go to Body -> raw -> JSON and send a GET request with the following body
{
    "username": "string",
    "password": "string"
}

Respose example

{
    "user": {
        "id": 1,
        "username": "Beverly Lindgren",
        "email": "kschmitt@yahoo.com",
        "role": "admin"
    },
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI3amE1ckoyOEt4bVcxMUtmQUNCSDBaRjlYRXY3ckFadEFIaXFoUERYTk4wPSIsImlhdCI6MTY5NDcxOTY2NiwibmJmIjoxNjk0NzE5NjY2LCJleHAiOjE2OTQ3MjMyNjYsImRhdGEiOnsiaWQiOjEsInVzZXJuYW1lIjoiQmV2ZXJseSBMaW5kZ3JlbiIsImVtYWlsIjoia3NjaG1pdHRAeWFob28uY29tIiwicm9sZSI6ImFkbWluIn19.7OnUs8t4d2DUT6kSM7kPfJC7wG5DnE92tsddUvXHCbs"
}

Deploy in Raiway.app🚀

Only the frist time deploying the app at Raiway.app

NIXPACKS_BUILD_CMD=composer install && php artisan migrate --force && php artisan db:seed --force

Useful commands

1. Create a project

    composer create-project --prefer-dist laravel/lumen [project-name]

1. 1 Create a schema/migration

    php artisan make:migration create_users_table

2. Execute migrations

   php artisan migrate
Only frist time (create the tables)

3. Reset and re-create again, (when we make changes in the migrations)

   php artisan migrate:fresh

4. Fill the tables with random data

   php artisan db:seed nameOfTheSeeder

5. insert data in the tables

   php artisan db:seed

6. Create a seeder

   php artisan make:seeder nameTableSeeder
Note: the name of the seeder must be the name of the table in singular and start with capital letter
Example
php artisan make:model Topic

Build Status Total Downloads Latest Stable Version License

Laravel Lumen is a stunningly fast PHP micro-framework for building web applications with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Lumen attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as routing, database abstraction, queueing, and caching.

Official Documentation

Documentation for the framework can be found on the Lumen website.

Contributing

Thank you for considering contributing to Lumen! The contribution guide can be found in the Laravel documentation.

Security Vulnerabilities

If you discover a security vulnerability within Lumen, please send an e-mail to Taylor Otwell at taylor@laravel.com. All security vulnerabilities will be promptly addressed.

License

The Lumen framework is open-sourced software licensed under the MIT license.

Resources

About

App server-side

https://jim-rest-production.up.railway.app/

License:MIT License


Languages

Language:PHP 100.0%