Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MetaRL
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Wang, Mia
MetaRL
Commits
22a831e7
Commit
22a831e7
authored
2 years ago
by
Mia Wang
Browse files
Options
Downloads
Patches
Plain Diff
change backbone
parent
550daa53
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
.DS_Store
+0
-0
0 additions, 0 deletions
.DS_Store
backend/.flaskenv
+2
-0
2 additions, 0 deletions
backend/.flaskenv
backend/react_app.py
+12
-0
12 additions, 0 deletions
backend/react_app.py
library/app.py
+0
-2
0 additions, 2 deletions
library/app.py
src/App.js
+51
-24
51 additions, 24 deletions
src/App.js
with
65 additions
and
26 deletions
.DS_Store
+
0
−
0
View file @
22a831e7
No preview for this file type
This diff is collapsed.
Click to expand it.
backend/.flaskenv
0 → 100644
+
2
−
0
View file @
22a831e7
FLASK_APP=react_app.py
FLASK_ENV=development
\ No newline at end of file
This diff is collapsed.
Click to expand it.
backend/react_app.py
0 → 100644
+
12
−
0
View file @
22a831e7
from
flask
import
Flask
api
=
Flask
(
__name__
)
@api.route
(
'
/profile
'
)
def
my_profile
():
response_body
=
{
"
name
"
:
"
Nagato
"
,
"
about
"
:
"
Hello! I
'
m a full stack developer that loves python and javascript
"
}
return
response_body
\ No newline at end of file
This diff is collapsed.
Click to expand it.
library/app.py
+
0
−
2
View file @
22a831e7
...
...
@@ -17,7 +17,5 @@ app = create_app()
port
=
int
(
os
.
environ
.
get
(
"
PORT
"
,
5000
))
if
__name__
==
'
__main__
'
:
app
.
run
(
debug
=
True
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/App.js
+
51
−
24
View file @
22a831e7
...
...
@@ -7,32 +7,59 @@ import axios from "axios";
function
App
()
{
//
const [formData, setFormData] = useState(null)
const
[
formData
,
setFormData
]
=
useState
(
null
)
// function getData() {
// axios({
// method: "POST",
// url:"/profile",
// })
// .then((response) => {
// const res =response.data
// setProfileData(({
// profile_name: res.name,
// about_me: res.about}))
// }).catch((error) => {
// if (error.response) {
// console.log(error.response)
// console.log(error.response.status)
// console.log(error.response.headers)
// }
// })}
//end of new line
function
getData
()
{
axios
({
method
:
"
POST
"
,
url
:
"
/profile
"
,
})
.
then
((
response
)
=>
{
const
res
=
response
.
data
setProfileData
(({
profile_name
:
res
.
name
,
about_me
:
res
.
about
}))
}).
catch
((
error
)
=>
{
if
(
error
.
response
)
{
console
.
log
(
error
.
response
)
console
.
log
(
error
.
response
.
status
)
console
.
log
(
error
.
response
.
headers
)
}
})}
return
(
<
div
>
<
Home
/>
<
/div
>
);
return
(
<
div
className
=
"
App
"
>
<
header
className
=
"
App-header
"
>
<
img
src
=
{
logo
}
className
=
"
App-logo
"
alt
=
"
logo
"
/>
<
p
>
Edit
<
code
>
src
/
App
.
js
<
/code> and save to reload
.
<
/p
>
<
a
className
=
"
App-link
"
href
=
"
https://reactjs.org
"
target
=
"
_blank
"
rel
=
"
noopener noreferrer
"
>
Learn
React
<
/a
>
{
/* new line start*/
}
<
p
>
To
get
your
profile
details
:
<
/p><button onClick={getData}>Click me</
button
>
{
profileData
&&
<
div
>
<
p
>
Profile
name
:
{
profileData
.
profile_name
}
<
/p
>
<
p
>
About
me
:
{
profileData
.
about_me
}
<
/p
>
<
/div
>
}
{
/* end of new line */
}
<
/header
>
<
/div
>
);
// return (
// <div>
// <Home />
// </div>
// );
}
export
default
App
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment