Skip to content

Commit

Permalink
Proxy api requests and allow setting api root
Browse files Browse the repository at this point in the history
  • Loading branch information
jbeisen committed Aug 8, 2023
1 parent 81337f6 commit 39c1bd6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion arroyo-console/src/lib/data_fetching.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export type OperatorMetricGroup = schemas['OperatorMetricGroup'];
export type Connector = schemas['Connector'];
export type Checkpoint = schemas['Checkpoint'];

const BASE_URL = 'http://localhost:8000/api';
const BASE_URL = '/api';
export const { get, post, patch, del } = createClient<paths>({ baseUrl: BASE_URL });

const processResponse = (data: any | undefined, error: any | undefined) => {
Expand Down
11 changes: 9 additions & 2 deletions arroyo-console/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
server: {
proxy: {
'/api': {
target: process.env.API_ROOT || 'http://localhost:8000',
},
},
},
});

0 comments on commit 39c1bd6

Please sign in to comment.