You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,23 +7,23 @@
7
7
- Alembic migrations
8
8
- Very minimal project structure yet ready for quick start building new api
9
9
- Refresh token endpoint (not only access like in official template)
10
-
- Two databases in docker-compose.yml (second for tests)
10
+
- Two databases in docker-compose.yml (second one for tests)
11
11
- poetry
12
12
-`pre-push.sh` script with poetry export, autoflake, black, isort and flake8
13
-
- Setup for tests, one big test for token flow and very extensible `conftest.py`
13
+
- Setup for async tests, one func test for token flow and very extensible `conftest.py`
14
14
15
15
## What this repo is
16
16
17
-
This is a minimal template for FastAPI backend + postgresql db as of 2021, `async` style for database sessions, endpoints and tests. It provides basic codebase that almost every application has, but nothing more.
17
+
This is a minimal template for FastAPI backend + postgresql db as of 2021.11, `async` style for database sessions, endpoints and tests. It provides basic codebase that almost every application has, but nothing more.
18
18
19
19
## What this repo is not
20
20
21
-
It is not complex, full featured solutions for all human kind problems. It doesn't include any third party that isn't necessary for most of apps (dashboards, queues) or implementation differs so much in every project that it's pointless (complex user model, emails).
21
+
It is not complex, full featured solutions for all human kind problems. It doesn't include any third party that isn't necessary for most of apps (dashboards, queues) or implementation differs so much in every project that it's pointless (complex User model, emails, RBAC, permissions).
# Alembic migrations upgrade and initial_data.py script
38
38
bash init.sh
39
39
# And this is it:
40
-
uvicorn app.main:app
40
+
uvicorn app.main:app --reload
41
41
```
42
42
43
43
tests:
44
44
45
45
```bash
46
+
# Note, it will use second database declared in docker-compose.yml, not default one
46
47
pytest
47
-
# Note, it will use second database declared in docker-compose.yml, not default one like
48
-
# in official template
48
+
49
49
```
50
50
51
51
## About
@@ -54,6 +54,6 @@ This project is heavily base on official template https://github.com/tiangolo/fu
54
54
55
55
`2.0` style SQLAlchemy API is good enough so there is no need to write everything in `crud` and waste our time... The `core` folder was also rewritten. There is great base for writting tests in `tests`, but I didn't want to write hundreds of them, I noticed that usually after changes in the structure of the project, auto tests are useless and you have to write them from scratch anyway (delete old ones...), hence less than more. Similarly with the `User` model, it is very modest, because it will be adapted to the project anyway (and there are no tests for these endpoints, you would remove them probably).
56
56
57
-
## Learn by example
57
+
## Step by step example
58
58
59
-
Let's imagine we need to create API for a website where users brag about their dogs... or whatever, they just can crud dogs in user panel for some reason. We will add dummy model Dog to our API, with relation to the default table User and crud auth endpoints, then test it shortly.
59
+
I always enjoy to to have some kind of example in templates (even if I don't like it much, _some_ parts may be useful and save my time...), so let's create `POST` endpoint for creating dogs.
0 commit comments