Toggle navigation
Toggle navigation
This project
Loading...
Sign in
박민정
/
We-Shop
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
박민정
2021-06-04 17:06:56 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
146ee0c39fccb2b0fbd32f7b9eca2e16d2f1ad38
146ee0c3
1 parent
660fc4dc
[fix] Fix server-client connection error
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
2 deletions
boiler-plate/client/src/components/views/LandingPage/LandingPage.js
boiler-plate/client/src/setupProxy.js
boiler-plate/server/index.js
boiler-plate/client/src/components/views/LandingPage/LandingPage.js
View file @
146ee0c
...
...
@@ -4,7 +4,7 @@ import axios from 'axios'
function
LandingPage
()
{
// 랜딩페이지에 들어오자마자
useEffect
(()
=>
{
axios
.
get
(
'
http://localhost:5000
/api/hello'
)
// get request를 서버로 보냄 (endpoint는 /api/hello)
axios
.
get
(
'/api/hello'
)
// get request를 서버로 보냄 (endpoint는 /api/hello)
.
then
(
response
=>
console
.
log
(
response
.
data
))
// 서버로부터 응답 받은 내용을 콘솔에 출력
},
[])
...
...
boiler-plate/client/src/setupProxy.js
0 → 100644
View file @
146ee0c
const
{
createProxyMiddleware
}
=
require
(
'http-proxy-middleware'
);
module
.
exports
=
function
(
app
)
{
app
.
use
(
'/api'
,
createProxyMiddleware
({
target
:
'http://localhost:5000'
,
changeOrigin
:
true
,
})
);
};
\ No newline at end of file
boiler-plate/server/index.js
View file @
146ee0c
...
...
@@ -111,7 +111,7 @@ app.get('/api/users/logout', auth, (req, res) => {
// test
app
.
get
(
'/api/hello'
,
(
req
,
res
)
=>
{
res
.
send
(
"hello"
);
res
.
send
(
"hello
world
"
);
})
app
.
listen
(
port
,
()
=>
{
...
...
Please
register
or
login
to post a comment