mirror of
https://github.com/rommapp/romm.git
synced 2026-02-18 00:27:41 +01:00
proxy redirect to api added in vite
This commit is contained in:
0
.github/actions/build.sh
vendored
Normal file → Executable file
0
.github/actions/build.sh
vendored
Normal file → Executable file
@@ -19,19 +19,19 @@ igdbh: IGDBHandler = IGDBHandler()
|
||||
dbh: DBHandler = DBHandler()
|
||||
|
||||
|
||||
@app.get("/api/platforms/{slug}/roms")
|
||||
@app.get("/platforms/{slug}/roms")
|
||||
async def platforms(slug):
|
||||
"""Returns roms data of the desired platform"""
|
||||
return {'data': [Rom(*r) for r in dbh.get_roms(slug)]}
|
||||
|
||||
|
||||
@app.get("/api/platforms")
|
||||
@app.get("/platforms")
|
||||
async def platforms():
|
||||
"""Returns platforms data"""
|
||||
return {'data': [Platform(*p) for p in dbh.get_platforms()]}
|
||||
|
||||
|
||||
@app.get("/api/scan")
|
||||
@app.get("/scan")
|
||||
async def scan(overwrite: bool=False):
|
||||
"""Scan platforms and roms and write them in database."""
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ http {
|
||||
|
||||
# Backend api calls
|
||||
location /api {
|
||||
# rewrite /api/(.*) /$1 break;
|
||||
rewrite /api/(.*) /$1 break;
|
||||
proxy_pass http://localhost:5000/;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "romm",
|
||||
"version": "0.12",
|
||||
"version": "0.13",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite --host",
|
||||
|
||||
@@ -38,10 +38,11 @@ export default defineConfig({
|
||||
server: {
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'https://localhost:5000',
|
||||
changeOrigin: true,
|
||||
target: 'http://localhost:5000',
|
||||
changeOrigin: false,
|
||||
secure: false,
|
||||
ws: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, ''),
|
||||
}
|
||||
},
|
||||
port: 3000,
|
||||
|
||||
Reference in New Issue
Block a user