homeapi/app/__init__.py
2023-10-29 11:15:51 +01:00

21 lines
419 B
Python

"""Module to run a simple api server"""
from flask import Flask
from .extensions import api, db
from .apiroutes import health_ns
def create_app():
"""Create and run the serverapp."""
app = Flask(__name__)
app.config.from_prefixed_env()
api.init_app(app)
db.init_app(app)
api.add_namespace(health_ns, path="/api/health")
with app.app_context():
db.create_all()
return app