Iguaria API

A minimal REST API for recipes. Fetch all recipes, get one by ID, or filter by ingredients.

Base URL

Local
http://localhost:4000

Status & Auth

Auth
None (public)
Rate limits
Not enforced

Tech

Runtime
Node.js + Express
Security
Helmet, CORS enabled

Quickstart

Run the server

$ npm install
$ node api.js
Server listens on http://localhost:4000.

Health check

GET /recipes

Authentication

No authentication required. All endpoints are public in this demo API.

Endpoints

GET /recipes List recipes

Returns all recipes. Optionally filter by one or more ingredients (case-insensitive match on exact ingredient tokens).

Query Parameters

NameTypeRequiredDescription
ingredientstringNoComma-separated list of ingredients to match all of them. Example: ?ingredient=eggs,bacon

Examples

cURL
curl -s "http://localhost:4000/recipes?ingredient=avocado"
JS (fetch)
fetch('http://localhost:4000/recipes')
  .then(r => r.json())
  .then(console.log)
Python (requests)
import requests
print(requests.get('http://localhost:4000/recipes', timeout=10).json())

Success Response 200

[
  {
    "id": 1,
    "title": "Spaghetti Carbonara",
    "ingredients": ["spaghetti", "eggs", "parmesan cheese", "bacon", "black pepper", "salt"],
    "instructions": "Cook pasta. Mix eggs and cheese. Fry bacon. Combine everything and serve with pepper.",
    "image": "https://example.com/images/carbonara.jpg",
    "tags": ["italian", "pasta", "quick"],
    "author": "Gonçalo Amaro"
  }
]

Error Response 404

{ "error": "No recipes with those ingredients" }
GET /recipes/:id Get recipe by ID

Path Parameters

NameTypeRequiredDescription
idnumberYesRecipe identifier (integer)

Example

GET http://localhost:4000/recipes/1

Success Response 200

{
  "id": 1,
  "title": "Spaghetti Carbonara",
  "ingredients": ["spaghetti", "eggs", "parmesan cheese", "bacon", "black pepper", "salt"],
  "instructions": "Cook pasta. Mix eggs and cheese. Fry bacon. Combine everything and serve with pepper.",
  "image": "https://example.com/images/carbonara.jpg",
  "tags": ["italian", "pasta", "quick"],
  "author": "Gonçalo Amaro"
}

Error Response 404

{ "error": "Recipe not found" }

Data Models

FieldTypeDescription
idnumberUnique recipe ID
titlestringRecipe name
ingredientsstring[]List of ingredients
instructionsstringPreparation steps
imagestringImage URL
tagsstring[]Labels such as cuisine or course
authorstringRecipe author

Errors

Errors are returned as JSON with an error string. Typical statuses include:

StatusWhenBody
404Recipe not found or no matches for ingredient filter{ "error": "..." }
500Unexpected server error{ "error": "Internal Server Error" }

Code Examples

Get all recipes (Node.js)

import fetch from 'node-fetch';
const res = await fetch('http://localhost:4000/recipes');
const data = await res.json();
console.log(data);

Filter by ingredients (Python)

import requests
r = requests.get('http://localhost:4000/recipes', params={'ingredient': 'eggs,bacon'})
print(r.status_code, r.json())

Get by ID (cURL)

curl -s http://localhost:4000/recipes/10 | jq

Changelog

  • v1.0.0 – Initial public endpoints: GET /recipes, GET /recipes/:id