<<<<<<< HEAD Absolutely! Let’s summarize what I remember about skynet-api and then create a full README.md draft for it.
- It's the backend REST API for your Skynet projects.
- Provides endpoints for user authentication and registration (at least
/auth/register). - Returns JSON responses, including proper validation errors.
- Works with
skynet-uias the frontend andskynet-corefor API client and helpers. - Uses HTTP status codes to indicate success (
2xx) or errors (4xxfor validation,5xxfor server errors). - Can be consumed via the
ApiClientfromskynet-core.
# Skynet API
**Skynet API** is a RESTful backend service for the Skynet project.
It provides endpoints for user authentication, registration, and other resources to be consumed by frontend applications like **skynet-ui**.
---
## Features
- **User Authentication & Registration**
- `POST /auth/register` → Register a new user
- `POST /auth/login` → Authenticate a user (planned)
- Validation with proper HTTP error codes
- **JSON Responses**
- Standardized response format
- Returns `errors` for validation failures
- Uses HTTP status codes for success and errors
- **Robust API Design**
- RESTful conventions
- Easily extendable for future resources
- **Integrates with Skynet UI and Core**
- Can be consumed with `Core\Http\Client\ApiClient` from `skynet-core`
---
## Installation
Clone the repository:
```bash
git clone https://github.com/Julioxfiles/skynet-api.git
cd skynet-apiInstall dependencies:
composer installSet up environment variables:
cp .env.example .env
Configure database credentials and other settings in .env.
Endpoint: POST /auth/register
Request Body (JSON):
{
"name": "John Doe",
"email": "john@example.com",
"password": "secret",
"password_confirmation": "secret"
}Success Response:
{
"status": 201,
"message": "User registered successfully",
"data": {
"id": 1,
"name": "John Doe",
"email": "john@example.com"
}
}Validation Error Response (422):
{
"status": 422,
"message": "Validation failed",
"errors": {
"email": ["The email field is required."],
"password": ["The password must be at least 6 characters."]
}
}use Core\Http\Client\ApiClient;
use Core\Http\Exceptions\ApiValidationException;
$api = new ApiClient();
try {
$response = $api->post('/auth/register', [
'name' => 'John Doe',
'email' => 'john@example.com',
'password' => 'secret',
'password_confirmation' => 'secret'
]);
if ($response->isSuccess()) {
echo "User registered successfully!";
}
} catch (ApiValidationException $e) {
print_r($e->errors());
}skynet-api/
├─ app/
│ ├─ Http/
│ │ ├─ Controllers/
│ │ └─ Middleware/
├─ routes/
│ └─ api.php
├─ database/
│ ├─ migrations/
│ └─ seeders/
├─ composer.json
├─ .env.example
└─ README.md
MIT
---
If you want, I can **also make a shorter, GitHub-friendly “About” version** for `skynet-api` just like we did for `skynet-ui` and `skynet-core`.
Do you want me to do that?
=======
This is a Clean Architectural API starting proyect.
9f0501da6550a47bcd97870ced6ea08097d5cf6f