File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
src/main/java/com/codesignal/pastebin/controller Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 22 xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
33 <modelVersion >4.0.0</modelVersion >
44
5- <groupId >com.example </groupId >
5+ <groupId >com.codesignal </groupId >
66 <artifactId >pastebin</artifactId >
77 <version >0.0.1-SNAPSHOT</version >
88 <name >pastebin</name >
Original file line number Diff line number Diff line change 1414@ RestController
1515public class FrontendController {
1616 private File resolveIndexHtml () {
17+ // When running from repo root
1718 File local = new File ("frontend/dist/index.html" );
1819 if (local .exists ()) return local ;
20+
21+ // When running from backend directory
22+ File sibling = new File ("../frontend/dist/index.html" );
23+ if (sibling .exists ()) return sibling ;
24+
25+ // When running in Docker image
1926 File container = new File ("/app/frontend/dist/index.html" );
2027 if (container .exists ()) return container ;
2128 return null ;
2229 }
2330 private File resolveStatic (String relPath ) {
2431 if (relPath == null || relPath .isBlank ()) return null ;
2532 if (relPath .startsWith ("/" )) relPath = relPath .substring (1 );
33+
34+ // When running from repo root
2635 File local = new File ("frontend/dist/" + relPath );
2736 if (local .exists () && local .isFile ()) return local ;
37+
38+ // When running from backend directory
39+ File sibling = new File ("../frontend/dist/" + relPath );
40+ if (sibling .exists () && sibling .isFile ()) return sibling ;
41+
42+ // When running in Docker image
2843 File container = new File ("/app/frontend/dist/" + relPath );
2944 if (container .exists () && container .isFile ()) return container ;
3045 return null ;
You can’t perform that action at this time.
0 commit comments