ohmyapi/docs/apps.md
Brian Wiborg 91baf968d7
📝 Add mkdocs
2025-10-02 01:01:57 +02:00

34 lines
758 B
Markdown

# Apps
Apps are a way to group database models and API routes that contextually belong together.
For example, OhMyAPI comes bundled with an `auth` app that carries a `User` and `Group` model and provides API endpoints for JWT authentication.
Apps help organizing projects by isolating individual components (or "features") from one another.
## Create an App
Create a new app by: `ohmyapi startapp <name>`, i.e.:
```
ohmyapi startapp restaurant
```
This will create the following directory structure:
```
myproject/
- restaurant/
- __init__.py
- models.py
- routes.py
- pyproject.toml
- README.md
- settings.py
```
Add `restaurant` to your `INSTALLED_APPS` in `settings.py` and restart you project runtime:
```
ohmyapi serve
```