Skip to content

Commit bc20a47

Browse files
committed
fix: update console routes and base path for ObjectStack application
1 parent 244cb11 commit bc20a47

File tree

5 files changed

+6
-23
lines changed

5 files changed

+6
-23
lines changed

apps/console/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default defineConfig({
5555
});
5656
```
5757

58-
The console will be available at `/console` in your ObjectStack application.
58+
The console will be available at `/` in your ObjectStack application.
5959

6060
## Development
6161

apps/console/objectstack.config.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const FixedConsolePlugin = {
5858
console.log('DEBUG: Registering SPA routes for ' + absoluteStaticRoot);
5959

6060
// Manual Asset Handler
61-
app.get('/console/assets/*', async (c: any) => {
61+
app.get('/assets/*', async (c: any) => {
6262
const filePath = path.join(absoluteStaticRoot, c.req.path.replace('/console', ''));
6363
if (fs.existsSync(filePath)) {
6464
const ext = path.extname(filePath);
@@ -75,13 +75,9 @@ const FixedConsolePlugin = {
7575
return c.text('Asset Not Found', 404);
7676
});
7777

78-
// Redirect Root
79-
app.get('/', (c: any) => {
80-
return c.redirect('/console/');
81-
});
8278

8379
// SPA Fallback
84-
app.get('/console/*', async (c: any) => {
80+
app.get('/*', async (c: any) => {
8581
if (c.req.path.startsWith('/api')) {
8682
return c.text('Not Found', 404);
8783
}

apps/console/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ import { ThemeProvider } from './components/theme-provider';
291291
export function App() {
292292
return (
293293
<ThemeProvider defaultTheme="system" storageKey="object-ui-theme">
294-
<BrowserRouter basename="/console">
294+
<BrowserRouter basename="/">
295295
<Routes>
296296
<Route path="/apps/:appName/*" element={<AppContent />} />
297297
<Route path="/" element={<RootRedirect />} />

apps/console/src/mocks/browser.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,8 @@ export async function startMockServer() {
7676
const handlers = mswPlugin.getHandlers();
7777
const worker = setupWorker(...handlers);
7878

79-
// Check if we are served under a base path (e.g. /console/)
80-
const isConsolePath = window.location.pathname.startsWith('/console/');
81-
// If the app is at /console/, the mockServiceWorker.js is likely served at /console/mockServiceWorker.js
8279
// unless vite base is handled strangely. But typically public assets follow base.
83-
const swUrl = isConsolePath ? '/console/mockServiceWorker.js' : '/mockServiceWorker.js';
80+
const swUrl = '/mockServiceWorker.js';
8481

8582
console.log(`[MSW] Starting worker with script at: ${swUrl}`);
8683

apps/console/vite.config.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import path from 'path';
44

55
// https://vitejs.dev/config/
66
export default defineConfig({
7-
base: '/console/',
7+
base: '/',
88
define: {
99
'process.env': {},
1010
'process.platform': '"browser"',
@@ -91,15 +91,5 @@ export default defineConfig({
9191
}
9292
},
9393
server: {
94-
proxy: {
95-
'/api': {
96-
target: 'http://localhost:3000',
97-
changeOrigin: true
98-
},
99-
'/graphql': {
100-
target: 'http://localhost:3000',
101-
changeOrigin: true
102-
}
103-
}
10494
}
10595
});

0 commit comments

Comments
 (0)