SA: Phase 4 Code Challenge Two Late Show API [COMPULSORY]
- Due Jun 24 by 11:59pm
- Points 12
- Submitting a website url
- Available after Jun 19 at 12am
๐ Flask Code Challenge โ Late Show API
๐ฏ Overview
You will build a Flask REST API for a Late Night TV show system from scratch, using:
โ
MVC architecture
โ
PostgreSQL (mandatory DB)
โ
Token-based authentication (JWT)
โ
Postman for API testing
โ
Git + GitHub for version control
โ
Full documentation in README.md
๐ Suggested Folder Structure
๐ป GitHub Repository Setup
โ
Create a new repo:
๐ github.com Links to an external site. โ New repo โ late-show-api-challenge โ No README/.gitignore
โ Initialize + push:
โ
.gitignore example:
๐ Setup
โ **Install dependencies:
**
โ PostgreSQL DB setup
Create your database in Postgres:
โ
Set your DATABASE_URI in server/config.py
โ Run DB setup
๐งฉ Models
User
idusername(unique)password_hash(hashed password)
Guest
idnameoccupation
Episode
iddatenumber- โ Cascade delete appearances on delete
Appearance
idrating(1-5 validation)guest_idepisode_id
๐ Authentication
โ
Required tech:Flask-JWT-Extended
โ
Must include:
POST /registerโ create a userPOST /loginโ get JWT token
โ Protect:
POST /appearancesDELETE /episodes/<int:id>
Clients must send:
๐ Routes
| Route | Method | Auth Required? | Description |
|---|---|---|---|
/register | POST | โ | Register a user |
/login | POST | โ | Log in + return JWT |
/episodes | GET | โ | List episodes |
/episodes/<int:id> | GET | โ | Get episode + appearances |
/episodes/<int:id> | DELETE | โ | Delete episode + appearances |
/guests | GET | โ | List guests |
/appearances | POST | โ | Create appearance |
๐งช Testing
โ
Import challenge-4-lateshow.postman_collection.json into Postman
โ
Include:
- Register + login
- Send the token in protected requests
๐ README.md Requirements
Your README.md must contain:
- Setup instructions (PostgreSQL, Flask, env vars)
- How to run (migrate, seed, run)
- Auth flow (register, login, token usage)
- Route list + sample request/response
- Postman usage guide
- GitHub repo link
โ Submission Checklist
- MVC folder structure
- PostgreSQL used (โ no SQLite)
- Models + validations complete
- Auth implemented + protected routes
- Seed data works
- All routes work and have been tested in Postman
- Clean, complete
README.md - GitHub repo pushed and shared