import logging from flask import Response, url_for from app import app from app.common.responses import success_response logger = logging.getLogger(__name__) @app.route("/favicon.ico") def favicon(): logger.info("GET /favicon.ico - Serving favicon") return url_for('static', filename='data:,') @app.route('/robots.txt') @app.route('/sitemap.xml') def static_from_root(): logger.info("GET /robots.txt or /sitemap.xml - Serving robots/sitemap") def disallow(string): return 'Disallow: {0}'.format(string) return Response("User-agent: *\n{0}\n".format("\n".join([ disallow('/bin/*'), disallow('/admin'), ]))) @app.route('/index', methods=['GET']) @app.route('/', methods=['GET']) def index(): logger.info("GET / or /index - API health check") return success_response({"success": "Api is online"})