A Flask-based RESTful API for managing episodes, guests, and appearances on a fictional late-night talk show. Built with SQLAlchemy, Flask-Migrate, and SQLite.
- View all episodes and their guest appearances
- View all guests and their associated episodes
- Create new guest appearances with validation
- Seed sample episode and guest data
- JSON responses for all endpoints
- Python 3.x
- Flask
- Flask SQLAlchemy
- Flask-Migrate
- SQLite (default)
- SQLAlchemy ORM
git clone https://github.com/TheWilliams254/Lateshow.git
cd lateshowpython3 -m venv venv
source venv/bin/activate venv\Scripts\activatepip install -r requirements.txtexport FLASK_APP=app.py
export FLASK_ENV=developmentflask db init
flask db migrate -m "Initial migration"
flask db upgradepython seed.pyflask runGET /episodes Returns a list of all episodes:
[
{
"id": 1,
"date": "1/11/99",
"number": 1
}
]GET /episodes/ Returns a specific episode with its guest appearances:
{
"id": 1,
"date": "1/11/99",
"number": 1,
"appearances": [
{
"id": 1,
"rating": 4,
"episode_id": 1,
"guest_id": 1,
"guest": {
"id": 1,
"name": "Michael J. Fox",
"occupation": "actor"
}
}
]
}POST /appearances Create a new appearance:
Request body:
{
"rating": 5,
"episode_id": 2,
"guest_id": 3
}Success response (201):
{
"id": 162,
"rating": 5,
"guest_id": 3,
"episode_id": 2,
"episode": {
"id": 2,
"date": "1/12/99",
"number": 2
},
"guest": {
"id": 3,
"name": "Tracey Ullman",
"occupation": "television actress"
}
}Error response (400/404):
{
"errors": ["Episode or Guest not found"]
}Use Postman, cURL, or browser tools to interact with endpoints. Sample test cases can be added with pytest or unittest.
MIT License. Free to use and modify.
William Wambugu williamwambugu663@gmail.com