Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/afperdomo2/curso-api-laravel
Curso de API REST con Laravel (Platzi)
https://github.com/afperdomo2/curso-api-laravel
laravel8
Last synced: 9 days ago
JSON representation
Curso de API REST con Laravel (Platzi)
- Host: GitHub
- URL: https://github.com/afperdomo2/curso-api-laravel
- Owner: afperdomo2
- Created: 2023-06-14T04:13:59.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-07-31T01:38:39.000Z (over 1 year ago)
- Last Synced: 2024-10-11T11:21:09.195Z (about 1 month ago)
- Topics: laravel8
- Language: JavaScript
- Homepage:
- Size: 378 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## API Rest con Laravel
Curso de Platzi
### Ejecutar servidor de desarrollo
```sh
php artisan serve
```### Ejecutar las Migraciones y los Seeders
```sh
php artisan migrate --seed
```# API Documentation - Laravel Routes
## Introduction
This document provides a detailed description of the endpoints available in the Laravel API. The API serves as a platform for managing posts, and it supports multiple versions. Authentication is required to access certain endpoints.## Authentication
The API uses Sanctum for authentication. To access protected endpoints, clients must include a valid authentication token in the request headers.## Version 1 Endpoints
### Retrieve all posts
- URL: `/v1/posts`
- Method: `GET`
- Description: This endpoint allows users to retrieve a list of all posts in version 1.
- Authentication: Required (using Sanctum token)
- Response: A JSON array containing post objects with their respective details.### Retrieve a single post
- URL: `/v1/posts/{id}`
- Method: `GET`
- Description: This endpoint retrieves a specific post from version 1 based on its `id`.
- Authentication: Required (using Sanctum token)
- Response: A JSON object containing the post details.### Delete a post
- URL: `/v1/posts/{id}`
- Method: `DELETE`
- Description: This endpoint allows users to delete a post in version 1 based on its `id`.
- Authentication: Required (using Sanctum token)
- Response: A JSON object with a `message` indicating the successful deletion.## Version 2 Endpoints
### Retrieve all posts v2
- URL: `/v2/posts`
- Method: `GET`
- Description: This endpoint allows users to retrieve a list of all posts in version 2.
- Authentication: Required (using Sanctum token)
- Response: A JSON array containing post objects with their respective details.### Retrieve a single post v2
- URL: `/v2/posts/{id}`
- Method: `GET`
- Description: This endpoint retrieves a specific post from version 2 based on its `id`.
- Authentication: Required (using Sanctum token)
- Response: A JSON object containing the post details.## User Login
### User Login
- URL: `/login`
- Method: `POST`
- Description: This endpoint allows users to log in and obtain an authentication token.
- Request Body: A JSON object containing `email` and `password` fields.
- Response: A JSON object containing the authentication token and user details.#### Example Request Body:
```json
{
"email": "[email protected]",
"password": "secret_password",
"name": "ex: tablet|pc|android|iphone"
}