23 lines
528 B
Python
23 lines
528 B
Python
from flask import Flask, jsonify
|
|
from flask_sqlalchemy import SQLAlchemy
|
|
from flask_restplus import Api
|
|
|
|
db = SQLAlchemy()
|
|
|
|
|
|
def create_app(env=None):
|
|
from app.config import config_by_name
|
|
from app.routes import register_routes
|
|
|
|
app = Flask(__name__)
|
|
app.config.from_object(config_by_name[env or 'test'])
|
|
api = Api(app, title='Flaskerific API', version='0.1.0')
|
|
|
|
register_routes(api, app)
|
|
db.init_app(app)
|
|
|
|
@app.route('/health')
|
|
def health():
|
|
return jsonify('healthy')
|
|
return app
|