ohmyapi/docs/apps.md

35 lines
746 B
Markdown
Raw Permalink Normal View History

2025-10-02 00:49:53 +02:00
# 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` model and provides API endpoints for JWT authentication.
2025-10-02 00:49:53 +02:00
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
```