Meal Categories

Learn to write a real-time program that uses an API to read data from an internet data source.

Problem

Write a program that uses a live service for an online collection of recipes, and retrieves all meal categories listed there.

Here are the meal categories:
Beef
Breakfast
Chicken
Dessert
Goat
Lamb
Miscellaneous
Pasta
Pork
Seafood
Side
Starter
Vegan
Vegetarian
Demo retrieved meal categories

If you cannot connect to the service (for example, there is no internet connection or the server is down), the program shall exit gracefully with an error message. For example, if a service https://www.themealdb.com/ is suspended, and we try to connect to it, then we should be shown the following error message:

Unable to connect to the server, Error: 'Failed to open TCP connection
to themealdb.com/:80 (getaddrinfo: Name or service not known)'
Exiting the program by showing an error message

Purpose

  • Get content from a URL

  • Parse a ...