Showing
4 changed files
with
30 additions
and
1 deletions
... | @@ -22,4 +22,6 @@ npm-debug.log* | ... | @@ -22,4 +22,6 @@ npm-debug.log* |
22 | yarn-debug.log* | 22 | yarn-debug.log* |
23 | yarn-error.log* | 23 | yarn-error.log* |
24 | 24 | ||
25 | -.vscode | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
25 | +.vscode | ||
26 | + | ||
27 | +.env | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
frontend/.env.example
0 → 100644
1 | import React from 'react'; | 1 | import React from 'react'; |
2 | import { createGlobalStyle } from 'styled-components'; | 2 | import { createGlobalStyle } from 'styled-components'; |
3 | import { BrowserRouter, Route, Switch } from 'react-router-dom'; | 3 | import { BrowserRouter, Route, Switch } from 'react-router-dom'; |
4 | +import dotenv from 'dotenv'; | ||
4 | import HomePage from './pages/HomePage'; | 5 | import HomePage from './pages/HomePage'; |
5 | import LoginPage from './pages/LoginPage'; | 6 | import LoginPage from './pages/LoginPage'; |
6 | import SearchPage from './pages/SearchPage'; | 7 | import SearchPage from './pages/SearchPage'; |
7 | 8 | ||
9 | +dotenv.config(); | ||
10 | + | ||
8 | const GlobalStyle = createGlobalStyle` | 11 | const GlobalStyle = createGlobalStyle` |
9 | html, | 12 | html, |
10 | body, | 13 | body, | ... | ... |
frontend/src/lib/api/elasticsearch.js
0 → 100644
1 | +import axios from 'axios'; | ||
2 | + | ||
3 | +const esInstance = axios.create({ | ||
4 | + baseURL: process.env.API_ENDPOINT, | ||
5 | + headers: { | ||
6 | + 'Content-Type': 'application/json', | ||
7 | + Authorization: `Bearer ${process.env.SEARCH_KEY}`, | ||
8 | + }, | ||
9 | +}); | ||
10 | + | ||
11 | +export const search = async searchWord => { | ||
12 | + const res = await esInstance.post( | ||
13 | + `/api/as/v1/engines/${process.env.APP_SEARCH_ENGINE_NAME}/search`, | ||
14 | + { | ||
15 | + query: searchWord, | ||
16 | + } | ||
17 | + ); | ||
18 | + | ||
19 | + console.log(res); | ||
20 | + return res; | ||
21 | +}; |
-
Please register or login to post a comment