chore: config

This commit is contained in:
Fernando Araoz 2025-02-14 06:30:47 -05:00
parent 43f0d727f5
commit a2bec0f60c
7 changed files with 84 additions and 13 deletions

2
.env
View File

@ -1 +1 @@
VITE_BACKEND_URL=http://localhost:8000/api
VITE_BACKEND_URL=http://localhost:8807/api

View File

@ -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
```

View File

@ -7,6 +7,7 @@
--on-surface: white;
--surface-variant: #27272a;
--on-surface-variant: white;
--border-1: #aaaaaa;
--root-color: #F9A8D4;

41
nginx.conf Normal file
View File

@ -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;
}

View File

@ -1,8 +1,39 @@
import { A } from "@solidjs/router"
import { Card } from "../components/card"
export function IndexPage()
{
return (
<div>
:D (happy)
<Navbar />
<div class="m-1">
<Card>
<div>
<h2 class="font-bold text-lg">Random Albums</h2>
</div>
</Card>
</div>
<div class="m-1">
<Card>
<div>
<h2 class="font-bold text-lg">Most Played</h2>
</div>
</Card>
</div>
</div>
)
}
function Navbar()
{
return (
<nav
border-b="1 c-border-1"
class="sticky top-0 py-2 px-2"
>
<A href="/" class="font-bold">
MusicToGo
</A>
</nav>
)
}

View File

@ -6,7 +6,7 @@ export function LoginPage()
{
async function onSubmit(ev: SubmitEvent)
{
fetch_api("/login", {
fetch_api("/auth/login", {
method: "post",
})
ev.preventDefault()

View File

@ -12,6 +12,7 @@ export default defineConfig({
"c-on-surface": "var(--on-surface)",
"c-surface-variant": "var(--surface-variant)",
"c-on-surface-variant": "var(--on-surface-variant)",
"c-border-1": "var(--border-1)",
"c-root-color": "var(--root-color)",
"c-primary": "var(--primary)",