MIL-002: backend basics and Hello Flask #33
No files matched your search
@@ -0,0 +1,12 @@
|
|||||||
|
## @file get_greeting.py
|
||||||
|
# @brief Use case that provides the greeting.
|
||||||
|
"""Use case that provides the greeting."""
|
||||||
|
|
||||||
|
from flask_day_54.domain.constants import GREETING
|
||||||
|
|
||||||
|
|
||||||
|
## @brief Return the greeting to show the user.
|
||||||
|
# @return The greeting text.
|
||||||
|
def get_greeting() -> str:
|
||||||
|
"""Return the greeting to show the user."""
|
||||||
|
return GREETING
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
## @file hello.py
|
||||||
|
# @brief The minimal Flask application of lectures 1 and 2.
|
||||||
|
"""The minimal Flask application of lectures 1 and 2."""
|
||||||
|
|
||||||
|
from flask import Flask
|
||||||
|
|
||||||
|
from flask_day_54.application.get_greeting import get_greeting
|
||||||
|
|
||||||
|
## @brief The Flask application object.
|
||||||
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
## @brief Handle GET / and answer with the greeting.
|
||||||
|
# @return The greeting as the response body.
|
||||||
|
@app.route("/")
|
||||||
|
def hello_world() -> str:
|
||||||
|
"""Answer the root route with the greeting."""
|
||||||
|
return get_greeting()
|
||||||
Reference in new issue
Block a user