mirror of
https://github.com/rommapp/romm.git
synced 2026-06-28 14:56:01 +00:00
vite proxy to api redirect added
This commit is contained in:
@@ -19,19 +19,19 @@ igdbh: IGDBHandler = IGDBHandler()
|
||||
dbh: DBHandler = DBHandler()
|
||||
|
||||
|
||||
@app.get("/platforms/{slug}/roms")
|
||||
@app.get("/api/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("/platforms")
|
||||
@app.get("/api/platforms")
|
||||
async def platforms():
|
||||
"""Returns platforms data"""
|
||||
return {'data': [Platform(*p) for p in dbh.get_platforms()]}
|
||||
|
||||
|
||||
@app.get("/scan")
|
||||
@app.get("/api/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 +0,0 @@
|
||||
VITE_BACK_PORT="5000"
|
||||
@@ -5,7 +5,6 @@ import { useRouter } from 'vue-router'
|
||||
import { useTheme } from "vuetify";
|
||||
|
||||
// Props
|
||||
const backPort = import.meta.env.VITE_BACK_PORT
|
||||
const platforms = ref([])
|
||||
const currentPlatformName = ref(localStorage.getItem('currentPlatformName') || "")
|
||||
const currentPlatformSlug = ref(localStorage.getItem('currentPlatformSlug') || "")
|
||||
|
||||
@@ -5,7 +5,6 @@ import { useRouter } from 'vue-router'
|
||||
import { saveAs } from 'file-saver'
|
||||
|
||||
// Props
|
||||
const backPort = import.meta.env.VITE_BACK_PORT
|
||||
const roms = ref([])
|
||||
const romsFiltered = ref([])
|
||||
const currentFilter = ref('')
|
||||
|
||||
@@ -36,6 +36,14 @@ export default defineConfig({
|
||||
],
|
||||
},
|
||||
server: {
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'https://localhost:5000',
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
ws: true,
|
||||
}
|
||||
},
|
||||
port: 3000,
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user