Skip to content

Commit 2bc409e

Browse files
committed
Changed Backend README
1 parent d4671cc commit 2bc409e

1 file changed

Lines changed: 41 additions & 4 deletions

File tree

backend/README.md

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,47 @@ This backend is part of a full-stack CRUD application for managing courses. It i
1212

1313
## API Endpoints
1414

15-
- `POST /items/` — Create a new course
16-
- `GET /items/` — List all courses
17-
- `PUT /items/{item_id}` — Update a course
18-
- `DELETE /items/{item_id}` — Delete a course
15+
- `POST /api/v1/items/` — Create a new course
16+
- `GET /api/v1/items/` — List all courses
17+
- `PUT /api/v1/items/{item_id}` — Update a course
18+
- `DELETE /api/v1/items/{item_id}` — Delete a course
19+
20+
## OpenAPI Documentation
21+
22+
FastAPI automatically generates OpenAPI (Swagger) documentation for your API:
23+
24+
- **Interactive API Documentation (Swagger UI)**: [http://localhost:8000/docs](http://localhost:8000/docs)
25+
- **Alternative Documentation (ReDoc)**: [http://localhost:8000/redoc](http://localhost:8000/redoc)
26+
- **OpenAPI JSON Schema**: [http://localhost:8000/openapi.json](http://localhost:8000/openapi.json)
27+
28+
### Exporting OpenAPI Schema
29+
30+
To export the OpenAPI schema to a JSON file:
31+
32+
```sh
33+
python export_openapi.py
34+
```
35+
36+
This will create an `openapi_schema.json` file with your complete API specification.
37+
38+
### Generating Client Code
39+
40+
You can generate client libraries in various programming languages from your OpenAPI schema:
41+
42+
1. **Install the OpenAPI Generator CLI:**
43+
```sh
44+
npm install @openapitools/openapi-generator-cli -g
45+
```
46+
47+
2. **Generate a client (Python example):**
48+
```sh
49+
python generate_client.py python
50+
```
51+
52+
3. **List supported languages:**
53+
```sh
54+
python generate_client.py --list
55+
```
1956

2057
See [http://localhost:8000/docs](http://localhost:8000/docs) for interactive API documentation (Swagger UI).
2158

0 commit comments

Comments
 (0)