setup vite proxy for development

This commit is contained in:
Joel Mathew Thomas
2025-03-18 01:53:53 +05:30
parent 40b71c3fdb
commit ba18a7a27f
3 changed files with 14 additions and 6 deletions
+5 -5
View File
@@ -47,14 +47,14 @@ function ProcessingPage() {
console.log("Starting processing..."); console.log("Starting processing...");
processStep("http://127.0.0.1:8000/api/normalize", () => { processStep("/api/normalize", () => {
processStep("http://127.0.0.1:8000/api/trim", () => { processStep("/api/trim", () => {
if (response.audio_class === "Music") { if (response.audio_class === "Music") {
processStep("http://127.0.0.1:8000/api/resample", () => { processStep("/api/resample", () => {
processStep("http://127.0.0.1:8000/api/separate", () => setProgress(100), 100, "Separating sources into vocals, bass, drums and other..."); processStep("/api/separate", () => setProgress(100), 100, "Separating sources into vocals, bass, drums and other...");
}, 75, "Resampling audio to 44100Hz...", { sr: "44100" }); }, 75, "Resampling audio to 44100Hz...", { sr: "44100" });
} else { } else {
processStep("http://127.0.0.1:8000/api/noisereduce", () => setProgress(100), 100, "Reducing background noise from the audio..."); processStep("/api/noisereduce", () => setProgress(100), 100, "Reducing background noise from the audio...");
} }
}, 50, "Trimming silent parts from the audio..."); }, 50, "Trimming silent parts from the audio...");
}, 25, "Normalizing audio frequency..."); }, 25, "Normalizing audio frequency...");
+1 -1
View File
@@ -91,7 +91,7 @@ function UploadPage() {
file_uuid: string; file_uuid: string;
sr: number; sr: number;
audio_class: string; audio_class: string;
}>("http://127.0.0.1:8000/api/upload", formData, { }>("/api/upload", formData, {
headers: { headers: {
"Content-Type": "multipart/form-data", "Content-Type": "multipart/form-data",
}, },
+8
View File
@@ -4,4 +4,12 @@ import react from '@vitejs/plugin-react'
// https://vite.dev/config/ // https://vite.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [react()], plugins: [react()],
server: {
proxy: {
'/api': {
target: 'http://localhost:8000',
changeOrigin: true,
},
},
},
}) })