mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-31 04:38:11 +00:00
refactor: update routing to use app.use for SPA compatibility and add architectural refactoring plan for directory-based stack structure
This commit is contained in:
@@ -500,7 +500,8 @@ if (process.env.NODE_ENV === 'production') {
|
|||||||
app.use(express.static('public'));
|
app.use(express.static('public'));
|
||||||
|
|
||||||
// Handle SPA routing - serve index.html for non-API routes
|
// Handle SPA routing - serve index.html for non-API routes
|
||||||
app.get('*', (req: Request, res: Response) => {
|
// Using app.use middleware instead of app.get('*') for path-to-regexp compatibility
|
||||||
|
app.use((req: Request, res: Response) => {
|
||||||
if (!req.path.startsWith('/api')) {
|
if (!req.path.startsWith('/api')) {
|
||||||
res.sendFile('index.html', { root: 'public' });
|
res.sendFile('index.html', { root: 'public' });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { Component } from 'react';
|
import { Component } from 'react';
|
||||||
import type { ErrorInfo, ReactNode } from 'react';
|
import type { ErrorInfo, ReactNode } from 'react';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
|||||||
Reference in New Issue
Block a user