halfapi/README.md

74 lines
1.3 KiB
Markdown
Raw Normal View History

2020-07-14 15:14:23 +02:00
# HalfAPI
2021-09-01 15:19:51 +02:00
Base tools to develop comlex API with rights management.
2020-07-14 15:14:23 +02:00
## Dependencies
- python3
- python3-pip
2020-07-29 21:25:12 +02:00
- libgit2-dev
2021-09-01 15:19:51 +02:00
- starlette
- PyJWT
- click
- uvicorn
- orjson
- pyyaml
2020-07-14 15:14:23 +02:00
2021-09-01 15:19:51 +02:00
## Configuration
2020-07-14 15:14:23 +02:00
2021-09-01 15:19:51 +02:00
Configure HalfAPI in the file : .halfapi/config .
2020-07-14 15:14:23 +02:00
2021-09-01 15:19:51 +02:00
It's an **ini** file that contains at least two sections, project and domains.
2020-07-14 15:14:23 +02:00
2021-09-01 15:24:53 +02:00
2021-09-01 15:19:51 +02:00
### Project
2021-09-01 15:19:51 +02:00
The main configuration options without which HalfAPI cannot be run.
2020-07-14 15:14:23 +02:00
2021-09-01 15:19:51 +02:00
**name** : Project's name
2020-07-14 15:14:23 +02:00
2021-09-01 15:19:51 +02:00
**halfapi_version** : The HalfAPI version on which you work
2020-07-14 15:14:23 +02:00
2021-09-01 15:19:51 +02:00
**secret** : The file containing the secret to decode the user's tokens.
2021-09-01 15:19:51 +02:00
**port** : The port for the test server.
2021-09-01 15:19:51 +02:00
**loglevel** : The log level (info, debug, critical, ...)
2020-07-15 00:11:31 +02:00
2021-09-01 15:19:51 +02:00
### Domains
2020-07-15 00:11:31 +02:00
2021-09-01 15:19:51 +02:00
The name of the options should be the name of the domains' module, the value is the
submodule which contains the routers.
2020-07-15 00:11:31 +02:00
2021-09-01 15:19:51 +02:00
Example :
2020-07-15 00:11:31 +02:00
2021-09-01 15:19:51 +02:00
dummy_domain = .routers
2020-07-15 00:11:31 +02:00
2021-09-01 15:19:51 +02:00
## Usage
2020-07-15 00:11:31 +02:00
2021-09-01 15:19:51 +02:00
Develop an HalfAPI domain by following the examples located in
tests/dummy_domain . An HalfAPI domain should be an importable python module
that is available in the python path.
2020-07-15 00:11:31 +02:00
2021-09-01 15:19:51 +02:00
Run the project by using the `halfapi run` command.
2020-07-15 00:11:31 +02:00
2021-09-01 15:19:51 +02:00
## API Testing
2020-07-15 00:11:31 +02:00
2021-09-01 15:19:51 +02:00
@TODO
2020-07-15 00:11:31 +02:00
2021-09-01 15:19:51 +02:00
### Example
2020-07-29 21:25:12 +02:00
2021-09-01 15:19:51 +02:00
Check out the [sample project](https://github.com/halfAPI/halfapi_sample_project)
that helps you to build your own domain.
2020-07-29 21:25:12 +02:00
2021-09-01 15:19:51 +02:00
## Development
2020-07-29 21:25:12 +02:00
2021-09-01 15:19:51 +02:00
@TODO