This is a simple CRUD API for a blog built with Laravel. The API includes basic functionality for managing blog posts, user authentication using JWT, and more.
- Post Management: Create, Read, Update, and Delete blog posts.
- User Authentication: Secure endpoints using JWT (JSON Web Tokens).
- Clean and Modular Code: Well-organized codebase following Laravel best practices.
- PHP 7.3+
- Laravel 7+
- Composer
- Clone the repository:
git clone https://github.com/lucasltavares/blog-api-laravel.git
- Install dependencies using Composer:
composer install
- Set up the .env file with your configuration, including database settings and JWT secret.
- Run migrations:
php artisan migrate
- Launch the server:
php artisan serve
- POST /api/login: User login and JWT generation.
- GET /api/posts: Retrieve all blog posts.
- GET /api/post/{id}: Retrieve a specific blog post.
- POST /api/post: Create a new blog post.
- PUT /api/post/{id}: Update an existing blog post.
- DELETE /api/post/{id}: Delete a blog post.
To access protected routes, include the JWT token acquired on login in the Authorization header:
Authorization: Bearer your_token_here
- Implement categories for blog posts.
- Implement rest HATEOAS
- Implement validation
- Implement API results pagination