Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2021-1-capstone-design1
/
GCL_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
안형욱
2021-06-12 16:30:11 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0f9a27c1d81a041f2c209a93e7a3290eee23011e
0f9a27c1
1 parent
c3a64a88
config: dontenv setting 및 필요한 환경 변수 추가
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
0 deletions
.gitignore
frontend/.env.example
frontend/src/App.js
frontend/src/lib/api/elasticsearch.js
.gitignore
View file @
0f9a27c
...
...
@@ -23,3 +23,5 @@ yarn-debug.log*
yarn-error.log*
.vscode
.env
\ No newline at end of file
...
...
frontend/.env.example
0 → 100644
View file @
0f9a27c
REACT_APP_API_ENDPOINT={API_ENDPOINT}
REACT_APP_SEARCH_KEY={SEARCH_KEY}
REACT_APP_ENGINE_NAME={ENGINE_NAME}
\ No newline at end of file
frontend/src/App.js
View file @
0f9a27c
import
React
from
'react'
;
import
{
createGlobalStyle
}
from
'styled-components'
;
import
{
BrowserRouter
,
Route
,
Switch
}
from
'react-router-dom'
;
import
dotenv
from
'dotenv'
;
import
HomePage
from
'./pages/HomePage'
;
import
LoginPage
from
'./pages/LoginPage'
;
import
SearchPage
from
'./pages/SearchPage'
;
dotenv
.
config
();
const
GlobalStyle
=
createGlobalStyle
`
html,
body,
...
...
frontend/src/lib/api/elasticsearch.js
0 → 100644
View file @
0f9a27c
import
axios
from
'axios'
;
const
esInstance
=
axios
.
create
({
baseURL
:
process
.
env
.
API_ENDPOINT
,
headers
:
{
'Content-Type'
:
'application/json'
,
Authorization
:
`Bearer
${
process
.
env
.
SEARCH_KEY
}
`
,
},
});
export
const
search
=
async
searchWord
=>
{
const
res
=
await
esInstance
.
post
(
`/api/as/v1/engines/
${
process
.
env
.
APP_SEARCH_ENGINE_NAME
}
/search`
,
{
query
:
searchWord
,
}
);
console
.
log
(
res
);
return
res
;
};
Please
register
or
login
to post a comment