Spaces:
Sleeping
Sleeping
Xiao commited on
Commit ·
5815d8e
1
Parent(s): 0a64cc4
testing huggingface 5000 api
Browse files- .gitignore +5 -1
- .nginx/nginx.conf +6 -0
- src/App.js +17 -0
.gitignore
CHANGED
|
@@ -133,4 +133,8 @@ dmypy.json
|
|
| 133 |
|
| 134 |
.DS_Store
|
| 135 |
|
| 136 |
-
*.pid
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
|
| 134 |
.DS_Store
|
| 135 |
|
| 136 |
+
*.pid
|
| 137 |
+
|
| 138 |
+
dbt_project/data/
|
| 139 |
+
|
| 140 |
+
.env*
|
.nginx/nginx.conf
CHANGED
|
@@ -34,13 +34,19 @@ http {
|
|
| 34 |
# root /usr/share/nginx/html;
|
| 35 |
# root /app/public;
|
| 36 |
# index index.html index.htm;
|
|
|
|
|
|
|
| 37 |
proxy_pass http://localhost:8000/;
|
| 38 |
# try_files $uri /index.html =404;
|
| 39 |
proxy_http_version 1.1;
|
| 40 |
proxy_set_header Upgrade $http_upgrade;
|
| 41 |
proxy_set_header Connection 'upgrade';
|
| 42 |
proxy_set_header Host $host;
|
|
|
|
|
|
|
| 43 |
proxy_cache_bypass $http_upgrade;
|
|
|
|
|
|
|
| 44 |
}
|
| 45 |
|
| 46 |
error_page 500 502 503 504 /50x.html;
|
|
|
|
| 34 |
# root /usr/share/nginx/html;
|
| 35 |
# root /app/public;
|
| 36 |
# index index.html index.htm;
|
| 37 |
+
rewrite /api/(.*) /$1 break;
|
| 38 |
+
|
| 39 |
proxy_pass http://localhost:8000/;
|
| 40 |
# try_files $uri /index.html =404;
|
| 41 |
proxy_http_version 1.1;
|
| 42 |
proxy_set_header Upgrade $http_upgrade;
|
| 43 |
proxy_set_header Connection 'upgrade';
|
| 44 |
proxy_set_header Host $host;
|
| 45 |
+
proxy_set_header X-Real-IP $remote_addr;
|
| 46 |
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
| 47 |
proxy_cache_bypass $http_upgrade;
|
| 48 |
+
proxy_read_timeout 86400;
|
| 49 |
+
proxy_redirect off;
|
| 50 |
}
|
| 51 |
|
| 52 |
error_page 500 502 503 504 /50x.html;
|
src/App.js
CHANGED
|
@@ -2,6 +2,19 @@ import logo from './logo.svg';
|
|
| 2 |
import './App.css';
|
| 3 |
|
| 4 |
function App() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
return (
|
| 6 |
<div className="App">
|
| 7 |
<header className="App-header">
|
|
@@ -17,6 +30,10 @@ function App() {
|
|
| 17 |
>
|
| 18 |
Learn React -- - 10
|
| 19 |
</a>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
</header>
|
| 21 |
</div>
|
| 22 |
);
|
|
|
|
| 2 |
import './App.css';
|
| 3 |
|
| 4 |
function App() {
|
| 5 |
+
const handleButtonClick1 = () => {
|
| 6 |
+
fetch('http://localhost:5000/')
|
| 7 |
+
.then((response) => response.json())
|
| 8 |
+
.then((data) => console.log(data.message))
|
| 9 |
+
.catch((error) => console.error('An error occurred:', error));
|
| 10 |
+
};
|
| 11 |
+
|
| 12 |
+
const handleButtonClick2 = () => {
|
| 13 |
+
fetch('http://localhost:5000/api/')
|
| 14 |
+
.then((response) => response.json())
|
| 15 |
+
.then((data) => console.log(data.message))
|
| 16 |
+
.catch((error) => console.error('An error occurred:', error));
|
| 17 |
+
};
|
| 18 |
return (
|
| 19 |
<div className="App">
|
| 20 |
<header className="App-header">
|
|
|
|
| 30 |
>
|
| 31 |
Learn React -- - 10
|
| 32 |
</a>
|
| 33 |
+
<div>
|
| 34 |
+
<button onClick={handleButtonClick1}>Ping /</button>
|
| 35 |
+
<button onClick={handleButtonClick2}>Ping /api</button>
|
| 36 |
+
</div>
|
| 37 |
</header>
|
| 38 |
</div>
|
| 39 |
);
|