diff --git a/.env b/.env index e4fa827..44f58db 100644 --- a/.env +++ b/.env @@ -1 +1 @@ -VITE_BACKEND_URL=http://localhost:8000/api +VITE_BACKEND_URL=http://localhost:8807/api diff --git a/README.md b/README.md index 8d9b3cd..8bdbe83 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,10 @@ -# Reezer +# MusicToGo -Yet another rewrite of deemix, this time with: +Now a regular SPA! -- Rust in the backend - - Rocket.rs as server - - Swagger API docs -- Solidjs in the frontend - - SPA mode - - Bun - - UnoCSS -- Docker +## Nginx proxy + +```sh +docker run -p 8807:80 -v ./nginx.conf:/etc/nginx/nginx.conf:ro nginx +``` diff --git a/index.html b/index.html index d1309c8..e36d779 100644 --- a/index.html +++ b/index.html @@ -7,6 +7,7 @@ --on-surface: white; --surface-variant: #27272a; --on-surface-variant: white; + --border-1: #aaaaaa; --root-color: #F9A8D4; diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..8b50824 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,41 @@ +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + server { + listen 80; + + # Your frontend location + # location / { + # root /var/www/html; # or wherever your frontend lives + # try_files $uri $uri/ /index.html; + # } + + # Login endpoint + location /api/auth/login { + proxy_pass http://localhost:8808/api/auth/login; + + # Handle the API response + add_header Set-Cookie "auth_token=$upstream_http_x_auth_token; HttpOnly; Secure; Path=/; SameSite=Strict"; + + # Remove token from response body + proxy_set_header Accept "application/json"; + proxy_hide_header x-auth-token; + } + + # All other API calls + location /api/ { + proxy_pass http://localhost:8808/api/; + + # Extract cookie and set as header + proxy_set_header Authorization "Bearer $cookie_auth_token"; + + # Standard proxy headers you'll need + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + } + } +} + +events { + worker_connections 1024; +} diff --git a/src/pages/index.tsx b/src/pages/index.tsx index ca86d54..6286074 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -1,8 +1,39 @@ +import { A } from "@solidjs/router" +import { Card } from "../components/card" + export function IndexPage() { return (