{"id":15906322,"url":"https://github.com/softchris/fast-api","last_synced_at":"2025-04-02T22:43:37.295Z","repository":{"id":52488271,"uuid":"520991164","full_name":"softchris/fast-api","owner":"softchris","description":"fast api","archived":false,"fork":false,"pushed_at":"2022-08-03T18:33:24.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-08T13:14:37.264Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/softchris.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-03T18:29:09.000Z","updated_at":"2022-08-03T18:30:51.000Z","dependencies_parsed_at":"2022-09-21T04:02:09.159Z","dependency_job_id":null,"html_url":"https://github.com/softchris/fast-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softchris%2Ffast-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softchris%2Ffast-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softchris%2Ffast-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softchris%2Ffast-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/softchris","download_url":"https://codeload.github.com/softchris/fast-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246905830,"owners_count":20852818,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-06T13:22:29.559Z","updated_at":"2025-04-02T22:43:37.277Z","avatar_url":"https://github.com/softchris.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# My first Fast API app\n\n## Install Fast API\n\n1. Create a virtual environment:\n\n   ```console\n   python3 -m venv fast-env\n   ```\n\n   This creates a virtual environment **fast-env**.\n\n1. Active the virtual environment\n\n   ```console\n   source fast-env/bin/activate\n   ```\n\n1. Create a *requirements.txt* file and add **fastapi** at the top of the file:\n\n   ```console\n   touch requirements.txt\n   ```\n\n1. Install fastapi by installing dependencies from *requirements.txt*:\n\n   ```console\n   python -m pip install -r requirements.txt\n   ```\n\n1. Install a tool `uvicorn` that will help you run your app:\n\n   ```console\n   pip install \"uvicorn[standard]\"\n   ```\n\n## Create your app\n\n1. Create *main.py* and give it the following content:\n\n   ```python\n   from fastapi import FastAPI\n\n   app = FastAPI()\n    \n   @app.get(\"/\")\n   async def root():\n      return {\"message\": \"Hello World\"}\n   ```\n\n1. Run the following command in the console to run the app:\n\n   ```console\n   uvicorn main:app --reload\n   ```\n\n   \u003e The command uvicorn main:app refers to:\n\n   \u003e main: the file main.py (the Python \"module\").\napp: the object created inside of main.py with the line app = FastAPI().\n   \u003e --reload: make the server restart after code changes. Only use for development.\n\n   You will see output similar to:\n\n   ```output\n    INFO:     Will watch for changes in these directories: ['/Users/chnoring/Documents/dev/projects/python-projects/fast-demo']\n\n    INFO:     Uvicorn running on \u003chttp://127.0.0.1:8000\u003e (Press CTRL+C to quit)\n    INFO:     Started reloader process [93679] using WatchFiles\n    INFO:     Started server process [93684]\n    INFO:     Waiting for application startup.\n    INFO:     Application startup complete.\n   ```\n\n1. Navigate to **\u003chttp://127.0.0.1:8000/\u003e** in a browser and you will see the following JSON output:\n\n   ```json\n   {\n      \"message\": \"Hello World\"\n   }\n   ```\n\n## Open API docs\n\n1. Navigate to \u003chttp://127.0.0.1:8000/docs\u003e\n\n   You will see the following:\n\n   ![swagger](swagger.png)\n\n1. Navigate to \u003chttp://127.0.0.1:8000/redoc\u003e if you want to see the same docs using Redoc standard.\n\n1. To see the Open API JSON doc, go to \u003chttp://127.0.0.1:8000/openapi.json\u003e\n\n   Here's the JSON output:\n\n   ```json\n   {\n    \"openapi\": \"3.0.2\",\n        \"info\": {\n            \"title\": \"FastAPI\",\n            \"version\": \"0.1.0\"\n        },\n        \"paths\": {\n            \"/\": {\n                \"get\": {\n                    \"summary\": \"Root\",\n                    \"operationId\": \"root__get\",\n                    \"responses\": {\n                        \"200\": {\n                            \"description\": \"Successful Response\",\n                            \"content\": {\n                                \"application/    json\": {\n                                        \"schema\": {}\n                                    }\n                            }\n                        }\n                    }\n                }\n            }\n        }\n    }\n    // 20220801165325\n    // \u003chttp://127.0.0.1:8000/openapi.json\u003e\n    ​\n    {\n      \"openapi\": \"3.0.2\",\n      \"info\": {\n        \"title\": \"FastAPI\",\n        \"version\": \"0.1.0\"\n      },\n      \"paths\": {\n        \"/\": {\n          \"get\": {\n            \"summary\": \"Root\",\n            \"operationId\": \"root__get\",\n            \"responses\": {\n              \"200\": {\n                \"description\": \"Successful Response\",\n                \"content\": {\n                  \"application/json\": {\n                    \"schema\": {\n    \n                    }\n                  }\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n\n   ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftchris%2Ffast-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoftchris%2Ffast-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftchris%2Ffast-api/lists"}