22 lines
419 B
Python
22 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
|