File tree Expand file tree Collapse file tree 5 files changed +26
-28
lines changed
templates/react/{{cookiecutter.project_slug}}
backend/{{cookiecutter.module_name}}/api Expand file tree Collapse file tree 5 files changed +26
-28
lines changed Original file line number Diff line number Diff line change @@ -43,10 +43,10 @@ build-frontend: # Build the React app
43
43
@if [ ! -d " $( FRONTEND_FOLDER) /node_modules" ]; then \
44
44
$(MAKE ) install-frontend; \
45
45
fi
46
- cd $(FRONTEND_FOLDER ) ; rm -rf build && REACT_APP_DEVELOPMENT_ENVIRONMENT=false NODE_ENV=prod npm run build
46
+ cd $(FRONTEND_FOLDER ) ; rm -rf build && NODE_ENV=prod npm run build
47
47
48
48
start-frontend : # # Start the frontend in dev mode (hot reload)
49
- cd $(FRONTEND_FOLDER ) ; REACT_APP_DEVELOPMENT_ENVIRONMENT=true yarn start
49
+ cd $(FRONTEND_FOLDER ) ; yarn start
50
50
51
51
install : venv install-backend install-frontend # # Install dependencies
52
52
Original file line number Diff line number Diff line change 1
- from localstack .http import route , Request , Response
1
+ import logging
2
+
3
+ from localstack .http import Request , Response , route
2
4
3
5
from .. import static
4
6
7
+ LOG = logging .getLogger (__name__ )
8
+
9
+
5
10
class WebApp :
6
11
@route ("/" )
7
12
def index (self , request : Request , * args , ** kwargs ):
8
13
return Response .for_resource (static , "index.html" )
9
-
14
+
10
15
@route ("/<path:path>" )
11
16
def index2 (self , request : Request , path : str , ** kwargs ):
12
- return Response .for_resource (static , path )
17
+ try :
18
+ return Response .for_resource (static , path )
19
+ except Exception :
20
+ LOG .debug (f"File { path } not found, serving index.html" )
21
+ return Response .for_resource (static , "index.html" )
Original file line number Diff line number Diff line change 8
8
"@emotion/styled" : " ^11.11.5" ,
9
9
"@localstack/integrations" : " ^1.0.0" ,
10
10
"@mui/material" : " ^5.15.20" ,
11
- "@testing-library/react" : " ^13.4.0" ,
12
- "@types/node" : " ^16.18.99" ,
13
- "@types/react-dom" : " ^17.0.11" ,
14
11
"react" : " ^17.0.2" ,
15
12
"react-dom" : " ^17.0.2" ,
16
13
"react-router-dom" : " ^6.24.0" ,
19
16
},
20
17
"devDependencies" : {
21
18
"@esbuild-plugins/node-modules-polyfill" : " ^0.1.4" ,
19
+ "@testing-library/react" : " ^13.4.0" ,
20
+ "@types/node" : " ^16.18.99" ,
21
+ "@types/react" : " ^19.1.6" ,
22
+ "@types/react-dom" : " ^17.0.11" ,
22
23
"concurrently" : " ^8.2.2" ,
23
24
"esbuild" : " ^0.16.6" ,
24
25
"esbuild-envfile-plugin" : " ^1.0.2" ,
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
- import ReactDOM from 'react-dom' ;
2
- import './index.css' ;
3
- import { CustomRoutes } from './CustomRoutes' ;
4
- import { BrowserRouter } from 'react-router-dom' ;
5
- import { LocalStackThemeProvider } from '@localstack/integrations'
6
- import { DEVELOPMENT_ENVIRONMENT } from './constants' ;
7
-
8
- const EXTENSION_NAME = '{{cookiecutter.project_slug}}'
9
-
10
- const getBaseName = ( ) => {
11
- if ( window . location . origin . includes ( EXTENSION_NAME ) || DEVELOPMENT_ENVIRONMENT ) {
12
- return '' ;
13
- }
14
-
15
- return `/_extension/${ EXTENSION_NAME } ` ;
16
- } ;
1
+ import ReactDOM from "react-dom" ;
2
+ import "./index.css" ;
3
+ import { CustomRoutes } from "./CustomRoutes" ;
4
+ import { HashRouter } from "react-router-dom" ;
5
+ import { LocalStackThemeProvider } from "@localstack/integrations" ;
17
6
18
7
ReactDOM . render (
19
8
< LocalStackThemeProvider useExtensionLayout >
20
- < BrowserRouter basename = { getBaseName ( ) } >
9
+ < HashRouter >
21
10
< CustomRoutes />
22
- </ BrowserRouter >
11
+ </ HashRouter >
23
12
</ LocalStackThemeProvider > ,
24
- document . getElementById ( ' root' ) ,
13
+ document . getElementById ( " root" )
25
14
) ;
You can’t perform that action at this time.
0 commit comments