diff --git a/README.md b/README.md index 0036e64..8c6db83 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,141 @@ -
+# Mergington High School Activities API + +A FastAPI application for managing extracurricular activities at Mergington High School. Students can view available activities and sign up or unregister from them through a simple web interface or REST API. + +## Features + +- 📋 View all available extracurricular activities with details +- ✍️ Sign up for activities using student email +- ❌ Unregister from activities +- 🔄 Prevent duplicate signups +- 🖥️ Interactive web interface +- 📚 Auto-generated API documentation (Swagger/ReDoc) + +## Prerequisites + +- Python 3.7 or higher +- pip (Python package manager) + +## Installation + +1. Clone the repository: + ```bash + git clone https://github.com/cx-demo/skills-getting-started-with-github-copilot.git + cd skills-getting-started-with-github-copilot + ``` + +2. Install the required dependencies: + ```bash + pip install -r requirements.txt + ``` + +## Usage + +### Running the Application + +Start the FastAPI server: + +```bash +uvicorn src.app:app --reload +``` + +The application will be available at: +- **Web Interface**: http://localhost:8000/ +- **API Documentation (Swagger)**: http://localhost:8000/docs +- **API Documentation (ReDoc)**: http://localhost:8000/redoc + +### API Endpoints + +| Method | Endpoint | Description | +|--------|----------|-------------| +| `GET` | `/` | Redirect to the web interface | +| `GET` | `/activities` | Get all activities with details and participants | +| `POST` | `/activities/{activity_name}/signup?email=` | Sign up a student for an activity | +| `POST` | `/activities/{activity_name}/unregister?email=` | Remove a student from an activity | + +### Example API Usage + +**Get all activities:** +```bash +curl http://localhost:8000/activities +``` + +**Sign up for an activity:** +```bash +curl -X POST "http://localhost:8000/activities/Chess%20Club/signup?email=student@mergington.edu" +``` + +**Unregister from an activity:** +```bash +curl -X POST "http://localhost:8000/activities/Chess%20Club/unregister?email=student@mergington.edu" +``` -# 🎉 Congratulations cx-demo! 🎉 +## Project Structure - +``` +skills-getting-started-with-github-copilot/ +├── src/ +│ ├── app.py # FastAPI application with API endpoints +│ ├── static/ +│ │ ├── index.html # Web interface +│ │ ├── app.js # Frontend JavaScript +│ │ └── styles.css # Styling +│ └── README.md # Additional documentation +├── tests/ +│ └── test_app.py # Test suite +├── requirements.txt # Python dependencies +├── pytest.ini # Pytest configuration +└── README.md # This file +``` -### 🌟 You've successfully completed the exercise! 🌟 +## Available Activities -## 🚀 Share Your Success! +The application includes the following extracurricular activities: -**Show off your new skills and inspire others!** +- **Academic**: Chess Club, Programming Class, Math Olympiad, Science Club +- **Sports**: Gym Class, Soccer Team, Basketball Club +- **Arts**: Drama Club, Art Workshop + +Each activity has: +- Description +- Schedule +- Maximum participant capacity +- List of registered participants + +## Testing + +Run the test suite using pytest: + +```bash +pytest +``` + +The test suite includes: +- Activity listing tests +- Signup and unregister flow tests +- Duplicate signup prevention tests +- Error handling tests +- Redirect tests + +## Data Storage + +The application uses in-memory storage for simplicity. All data (activities and registrations) will be reset when the server restarts. This is suitable for development and learning purposes. + +## License + +This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. + +--- + +
+ +## 🎉 GitHub Skills Exercise Complete! 🎉 + + + +**This project was created as part of the "Getting Started with GitHub Copilot" exercise.** + +### 🚀 Share Your Success! Share on X @@ -20,15 +147,11 @@ Share on LinkedIn -### 🎯 What's Next? - -**Keep the momentum going!** +### 🎯 Continue Learning [![](https://img.shields.io/badge/Return%20to%20Exercise-%E2%86%92-1f883d?style=for-the-badge&logo=github&labelColor=197935)](https://github.com/cx-demo/skills-getting-started-with-github-copilot/issues/1) [![GitHub Skills](https://img.shields.io/badge/Explore%20GitHub%20Skills-000000?style=for-the-badge&logo=github&logoColor=white)](https://learn.github.com/skills) -*There's no better way to learn than building things!* 🚀 -
---