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
Commits
2b378408
Commit
2b378408
authored
Jun 19, 2020
by
Fia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first commit
parents
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
0 deletions
+49
-0
hello_app.py
hello_app.py
+16
-0
sample_app.py
sample_app.py
+0
-0
static/hello.html
static/hello.html
+33
-0
No files found.
hello_app.py
0 → 100644
View file @
2b378408
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 @
2b378408
static/hello.html
0 → 100644
View file @
2b378408
<!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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment