Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
Flask
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Metrics
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Administrator
Flask
Compare Revisions
9570385245c539712c77d51b44f7d075022046b7...640d6d4c6c84b9841bb0a1be715310870747bd22
Source
640d6d4c6c84b9841bb0a1be715310870747bd22
Select Git revision
...
Target
9570385245c539712c77d51b44f7d075022046b7
Select Git revision
Compare
Commits (2)
first commit
· 2b378408
Fia
authored
Jun 19, 2020
2b378408
Merge branch 'master' of
https://gitlab.saic.it/root/flask.git
· 640d6d4c
Fia
authored
Jun 19, 2020
640d6d4c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
0 deletions
+48
-0
hello_app.py
hello_app.py
+16
-0
sample_app.py
sample_app.py
+0
-0
static/hello.html
static/hello.html
+32
-0
No files found.
hello_app.py
0 → 100644
View file @
640d6d4c
from
flask
import
request
from
flask
import
jsonify
from
flask
import
Flask
app
=
Flask
(
__name__
)
@
app
.
route
(
'/hello'
,
methods
=
[
'POST'
])
def
hello
():
message
=
request
.
get_json
(
force
=
True
)
name
=
message
[
'name'
]
response
=
{
'greeting'
:
'Hello, '
+
name
+
'!'
}
return
jsonify
(
response
)
sample_app.py
0 → 100644
View file @
640d6d4c
static/hello.html
0 → 100644
View file @
640d6d4c
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
>
<title>
Hello, GNOME!
</title>
<style
type=
"text/css"
>
body
{
font-face
:
Cantarell
,
sans-serif
;
text-align
:
center
;
}
</style>
</head>
<body>
<input
id=
"name-input"
types=
"text"
>
<button
id=
"name-button"
>
Submit Name
</button>
<p
id=
"greeting"
></p>
<script
src=
"https://code.jquery.com/jquery-3.3.1.min.js"
></script>
<script>
$
(
"
#name-button
"
).
click
(
function
(
event
){
let
message
=
{
name
:
$
(
"
#name-input
"
).
val
()
}
$
.
post
(
"
http://127.0.0.1:5000/hello
"
,
JSON
.
stringify
(
message
),
function
(
response
){
$
(
"
#greeting
"
).
text
(
response
.
greeting
);
console
.
log
(
response
);
});
});
</script>
</body>
</html>
\ No newline at end of file