Skip to content

Repository files navigation

Manage Acticles

Clone project

git clone https://github.com/Hanna-hanna/manage-articles.git
cd manage-articles

Install Requirements

composer install
npm install

Create new database on the local database tool like TablePlus

Create file .env from env.example (on the root) and add info

    DB_DATABASE=name_your_database
    DB_USERNAME=your_username
    DB_PASSWORD=your_password
    

Migrate Database

php artisan migrate --seed

Set key for application

php artisan key:generate

Start project from your server or use local

php artisan serve

Check API in Postman

Register user (method post)

    http://localhost:8000/api/register
    
    {
        "name": "John Doe",
        "email": "john.doe@example.com",
        "password": "password",
        "password_confirmation": "password"
    }
    

Login user and get token (method post)

    http://localhost:8000/api/login
    
    {
        "email": "john.doe@example.com",
        "password": "password",
    }
    

Add the token to the Authorization header as a Bearer token to authenticate API requests.

Index Articles Page (method get)

    http://localhost:8000/api/articles
    

Index Articles Page (method get)

    http://localhost:8000/api/articles
    

Create New Article (method post)

http://localhost:8000/api/articles
    {
        "title": "test",
        "body": "description",
        "published_at": "1997-09-20T00:00:00.000000Z",
        "user_id": "1"
    }
    

Update Article - it works only with your articles (method post)

http://localhost:8000/api/articles/{article's id}
    {
        "title": "test",
        "body": "description222",
        "published_at": "1997-09-20T00:00:00.000000Z",
        "user_id": "1"
    }
    

Delete Article - it works only with your articles (method delete)

http://localhost:8000/api/articles/{article's id}

About

Laravel, Filament, Eloquent ORM, Authentication, Middleware, RESTful APIs

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages