-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- includes easier usage of external_resources (databases and services). - bugfix in logger (previously wrong function was declared as source of log-message) - updated documentation with more details and an additional exampleservice-section - now mainly using poetry. dephell is now used for package creation. - add additional tests for previously untested parts - added function for easier usage of versioned endpoints
- Loading branch information
Showing
118 changed files
with
3,716 additions
and
918 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: '3' | ||
|
||
services: | ||
testdb: | ||
image: postgres:11.2-alpine | ||
ports: | ||
- "5434:5432" | ||
environment: | ||
- POSTGRES_USER=postgres | ||
- POSTGRES_PASSWORD=1234 | ||
- POSTGRES_DB=monitordb |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__version__ = '0.1.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from app.endpoints.v1 import ENDPOINTS as v1 | ||
|
||
from fastapi_serviceutils.app.endpoints import set_version_endpoints | ||
|
||
LATEST = set_version_endpoints( | ||
endpoints=v1, | ||
version='latest', | ||
prefix_template='{route}' | ||
) | ||
|
||
ENDPOINTS = LATEST + v1 | ||
|
||
__all__ = ['ENDPOINTS'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from app.endpoints.v1 import example | ||
|
||
from fastapi_serviceutils.app.endpoints import set_version_endpoints | ||
|
||
ENDPOINTS = set_version_endpoints( | ||
endpoints=[example], | ||
version='v1', | ||
prefix_template='/api/{version}{route}' | ||
) | ||
|
||
__all__ = ['ENDPOINTS'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Contain error-messages to be used for the endpoints of v1.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from app.endpoints.v1.models import Example as Output | ||
from app.endpoints.v1.models import GetExample as Input | ||
from fastapi import APIRouter | ||
from fastapi import Body | ||
from starlette.requests import Request | ||
|
||
from fastapi_serviceutils.app import create_id_logger | ||
from fastapi_serviceutils.app import Endpoint | ||
|
||
ENDPOINT = Endpoint(router=APIRouter(), route='/example', version='v1') | ||
SUMMARY = 'Example request.' | ||
EXAMPLE = Body(..., example={'msg': 'some message.'}) | ||
|
||
|
||
@ENDPOINT.router.post('/', response_model=Output, summary=SUMMARY) | ||
async def example(request: Request, params: Input = EXAMPLE) -> Output: | ||
_, log = create_id_logger(request=request, endpoint=ENDPOINT) | ||
log.debug(f'received request for {request.url} with params {params}.') | ||
return Output(msg=params.msg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from pydantic import BaseModel | ||
|
||
|
||
class GetExample(BaseModel): | ||
msg: str | ||
|
||
|
||
class Example(BaseModel): | ||
msg: str | ||
|
||
|
||
__all__ = ['Example', 'GetExample'] |
Oops, something went wrong.