|
1 | | -# SimpleFastPyAPI |
| 1 | +# Simple FastAPI Py |
| 2 | + |
2 | 3 | Building a Simple REST API with Python and FastAPI |
| 4 | + |
| 5 | +## My Awesome FastAPI Project |
| 6 | + |
| 7 | +This is a simple REST API built with Python and FastAPI. |
| 8 | + |
| 9 | +## Installation |
| 10 | + |
| 11 | +Clone this repository to your local machine: |
| 12 | +```bash |
| 13 | +git clone https://github.com/your-username/my-fastapi-project.git |
| 14 | +``` |
| 15 | +Change into the project directory: |
| 16 | +```bash |
| 17 | +cd my-fastapi-project |
| 18 | +``` |
| 19 | + |
| 20 | +Install the project dependencies: |
| 21 | +```bash |
| 22 | +pip install -r requirements.txt |
| 23 | +``` |
| 24 | + |
| 25 | +Run the application: |
| 26 | +```bash |
| 27 | +uvicorn main:app --reload |
| 28 | +``` |
| 29 | + |
| 30 | +The application will start and be available at http://localhost:8000. |
| 31 | + |
| 32 | +## API Endpoints |
| 33 | + |
| 34 | +- Retrieve a list of users: |
| 35 | + |
| 36 | +```http |
| 37 | +GET /users |
| 38 | +``` |
| 39 | + |
| 40 | +Returns a list of all users in the system. |
| 41 | + |
| 42 | +- Retrieve details for a specific user: |
| 43 | + |
| 44 | +```http |
| 45 | +GET /users/{user_id} |
| 46 | +``` |
| 47 | +Returns details for a specific user with the given user_id. |
| 48 | + |
| 49 | +- Add a new user |
| 50 | + |
| 51 | +```http |
| 52 | +POST /users |
| 53 | +``` |
| 54 | + |
| 55 | +Adds a new user to the system. The request body should include a JSON object with the following properties: |
| 56 | + |
| 57 | + - `name` (string, required): the name of the user |
| 58 | + - `email` (string, required): the email address of the user |
| 59 | + - `password` (string, required): the password for the user |
| 60 | + |
| 61 | +- Update an existing user |
| 62 | +```http |
| 63 | +PUT /users/{user_id} |
| 64 | +``` |
| 65 | + |
| 66 | +Updates an existing user with the given user_id. The request body should include a JSON object with the following properties: |
| 67 | + |
| 68 | + - `name` (string, optional): the new name for the user |
| 69 | + - `email` (string, optional): the new email address for the user |
| 70 | + - `password` (string, optional): the new password for the user |
| 71 | + |
| 72 | +- Delete a user |
| 73 | + |
| 74 | +```http |
| 75 | +DELETE /users/{user_id} |
| 76 | +``` |
| 77 | + |
| 78 | +Deletes the user with the given user_id. |
| 79 | + |
| 80 | +## License |
| 81 | + |
| 82 | +This project is licensed under the GPL-3.0 License - see the LICENSE file for details. |
0 commit comments