DummyApp/app/routes.py

27 lines
748 B
Python
Raw Normal View History

from flask import Blueprint, render_template, jsonify
import os
import datetime
main = Blueprint('main', __name__)
@main.route('/')
def index():
return render_template('index.html',
title='Flask CI/CD Demo',
version=os.environ.get('APP_VERSION', '1.0.0'))
@main.route('/health')
def health():
return jsonify({
'status': 'healthy',
'timestamp': datetime.datetime.now().isoformat(),
'environment': os.environ.get('FLASK_ENV', 'production')
})
@main.route('/api/info')
def info():
return jsonify({
'app': 'Flask CI/CD Demo',
'version': os.environ.get('APP_VERSION', '1.0.0'),
'commit': os.environ.get('COMMIT_HASH', 'unknown')
})