diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..562b3c8 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,49 @@ +name: Build + +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run build + run: npm run build + + - name: Verify dist is up-to-date + run: | + if [[ -n $(git status dist/ --porcelain) ]]; then + echo "::error::dist/ is out of date. Please run 'npm run build' and commit the changes." + echo "" + echo "Files that differ:" + git status dist/ --porcelain + echo "" + echo "Diff:" + git diff dist/ + exit 1 + else + echo "dist/ is up-to-date" + fi + + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: dist + path: dist/ + retention-days: 7 diff --git a/README.md b/README.md new file mode 100644 index 0000000..659c522 --- /dev/null +++ b/README.md @@ -0,0 +1,77 @@ +# RESTful API Design - 7-Day Learning Module + +[![Build](https://github.com/d2kole/Restful-api-design/actions/workflows/build.yml/badge.svg)](https://github.com/d2kole/Restful-api-design/actions/workflows/build.yml) + +A self-contained, interactive HTML-based course teaching REST API concepts over 7 days. + +## Features + +- **Single-file distribution** - One HTML file, zero dependencies, works offline +- **Interactive learning** - Quizzes, code examples with syntax highlighting, progress tracking +- **Dark mode** - Toggle between light and dark themes +- **Progressive disclosure** - Complex code examples can be expanded for full details + +## Quick Start + +Open `dist/restful-api-design-7day-module.html` in any modern browser. + +## Curriculum + +| Day | Topic | Description | +|-----|-------|-------------| +| 1 | REST Fundamentals | HTTP verbs, status codes, resource naming | +| 2 | Resource Design | URL patterns, nested resources, filtering | +| 3 | Error Handling | Error classes, middleware, logging patterns | +| 4 | Authentication | JWT, OAuth, role-based access control | +| 5 | API Versioning | Version routing, cache headers, ETags | +| 6 | Performance | Pagination, rate limiting, compression | +| 7 | Testing & CI/CD | Test patterns, workflows, deployment | + +## Development + +### Prerequisites + +- Node.js 18+ + +### Setup + +```bash +npm install +``` + +### Build + +```bash +npm run build # Compile src/ → dist/ +npm run dev # Watch mode (auto-rebuild on changes) +npm run clean # Remove dist/ directory +``` + +### Project Structure + +``` +src/ +├── index.html # Main template with placeholders +├── styles/ # CSS files (base, layout, components, themes) +├── scripts/ # JavaScript modules (navigation, progress, quiz, etc.) +└── content/ # Day content partials (day1.html - day7.html) + +dist/ +└── restful-api-design-7day-module.html # Built single-file output + +build/ +└── build.js # Build script +``` + +## Contributing + +1. Edit files in `src/` (never modify `dist/` directly) +2. Run `npm run build` to compile +3. Test by opening `dist/restful-api-design-7day-module.html` +4. Commit both source and dist changes + +See [CLAUDE.md](CLAUDE.md) for detailed development guidelines. + +## License + +MIT