
Munchies πͺ
πͺ Whip up some coding magic with Munchies API! π Get tasty snack data thatβll make your apps pop π and keep your users munching with joy! ππ
βοΈ API Endpoints
π GET Methods
The following endpoints allow you to retrieve data from the Munchies API. π¦
π Get All Munchies
Use this endpoint to fetch a full list of available munchies.
GEThttps://munchies-v1.vercel.app/munchies
This will return a list of all munchie objects with their corresponding details. π
Example Code:
axios.get('https://munchies-v1.vercel.app/munchies') .then(response => console.log(response.data)) .catch(error => console.error('Error fetching munchies:', error));
π± Get Munchies by Category
Fetch munchies that belong to a specific category using this endpoint.
GEThttps://munchies-v1.vercel.app/munchies/category/:category
Replace :category
with the desired munchie category.
Example Code:
const category = 'Snacks'; // example category axios.get(`https://munchies-v1.vercel.app/munchies/category/${category}`) .then(response => console.log(response.data)) .catch(error => console.error('Error fetching munchies by category:', error));
π½ Get Munchie Categories
Use this endpoint to fetch all available munchie categories.
GEThttps://munchies-v1.vercel.app/munchies/categories
This will return a list of all available categories for munchies. π
Example Code:
axios.get('https://munchies-v1.vercel.app/munchies/categories') .then(response => console.log(response.data)) .catch(error => console.error('Error fetching munchie categories:', error));
β POST Methods
These endpoints allow you to create new data entries in the Munchies API. π
π Add a Munchie
Use this endpoint to add a new munchie to the database.
POSThttps://munchies-v1.vercel.app/addmunchie
Request Body:
{ "name": "Pizza", "category": "Snacks", "price": 9.99, "description": "Delicious cheesy pizza.", "imageUrl": "http://example.com/pizza.jpg" }
This request will create a new munchie in the database with the provided details. π
Example Code:
axios.post('https://munchies-v1.vercel.app/addmunchie', { name: "Pizza", category: "Snacks", price: 9.99, description: "Delicious cheesy pizza.", imageUrl: "http://example.com/pizza.jpg" }) .then(response => console.log('Munchie added:', response.data)) .catch(error => console.error('Error adding munchie:', error));
π Snack-tastic Resources!
Dive into our delicious APIs and savor the flavor of coding! π
βοΈ Love what you see? Give us a star on GitHub! Your support is the sprinkles on our cupcake! π§