Skip to content

Commit

Permalink
fix(config): add Swagger proxy settings in Vite configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
hdinia committed Feb 1, 2024
1 parent a5ab20d commit d208e11
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions webapp/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineConfig } from "vite";
import { type ProxyOptions, defineConfig } from "vite";

Check failure on line 1 in webapp/vite.config.ts

View workflow job for this annotation

GitHub Actions / npm-test (ubuntu-20.04)

'ProxyOptions' is defined but never used
import react from "@vitejs/plugin-react-swc";

const SERVER_URL = "http://localhost:8080";
Expand All @@ -8,22 +8,19 @@ export default defineConfig(({ mode }) => {
const isDesktopMode = mode === "desktop";

return {
// When the web application is running in Desktop mode,
// the web app is served at the `/static` entry point
// Serve the web app at the `/static` entry point on Desktop mode
base: isDesktopMode ? "/static/" : "/",
plugins: [react({ devTarget: "es2022" })],
server: {
port: 3000,
strictPort: true,
proxy: {
// Main API URLs
"/v1": SERVER_URL,
// Core API URLs
"/health": SERVER_URL,
"/kill": SERVER_URL,
"/version": SERVER_URL,
// WebSocket
"/ws": SERVER_URL,
// API, WebSocket and Swagger URLs
"^/(v1|health|kill|version|ws|openapi.json|redoc)": {
target: SERVER_URL,
changeOrigin: true, // Recommended for avoiding CORS issues
ws: true, // WebSocket support for hot module replacement
},
},
},
};
Expand Down

0 comments on commit d208e11

Please sign in to comment.