Retrieve a list of recipes with optional filtering, pagination, and sorting.
/api/recipes
Parameter | Description | Default |
---|---|---|
page |
Page number for pagination | 1 |
limit |
Number of recipes per page | 10 |
category |
Filter recipes by category ID | - |
search |
Search term to filter recipes | - |
sortBy |
Field and order to sort results (format: field:order) | - |
GET /api/recipes?page=2&limit=20
GET /api/recipes?category=1
GET /api/recipes?search=pasta
GET /api/recipes?sortBy=created_at:desc
GET /api/recipes?page=1&limit=10&category=2&search=salad&sortBy=judul:asc
{
"status": "success",
"recipes": [
{
"id": 1,
"judul": "Es Doger",
"imageUrl": "https://images.pexels.com/photos/444444/pexels-photo-444444.jpeg",
"deskripsi": "Minuman segar khas Bandung dengan campuran es serut dan aneka isian"
},
// ... more Recipes
],
"currentPage": 1,
"totalPages": 5,
"totalRecipes": 50
}
The API also includes endpoints for user management and authentication:
POST /api/auth/login
- User loginPOST /api/auth/register
- User registrationMost endpoints require authentication. Use the /api/auth
endpoints to obtain a token, then include
it in the Authorization
header of your requests:
Authorization: Bearer YOUR_TOKEN_HERE