File tree Expand file tree Collapse file tree
server/src/main/java/dev/harrel Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,24 +12,22 @@ static void main() {
1212 .route ("/*" )
1313 .build ();
1414 StaticContent webBundle =
15- StaticContent .ofClassPath ("/web/assets" )
16- .route ("/assets" )
15+ StaticContent .ofClassPath ("/web" )
16+ .route ("/*" )
17+ .directoryIndex ("files.index" )
1718 .preCompress ()
18- .putMimeTypeMapping ("js" , "application/javascript" )
19- .putMimeTypeMapping ("css" , "text/css" )
20- .putMimeTypeMapping ("png" , "image/png" )
21- .putMimeTypeMapping ("ico" , "image/x-icon" )
2219 .putResponseHeader ("Cache-Control" , "max-age=86400" )
2320 .build ();
2421 StaticContent robots =
2522 StaticContent .ofClassPath ("/robots/robots.txt" )
2623 .route ("/robots.txt" )
24+ .putMimeTypeMapping ("txt" , "application/javascript" )
2725 .build ();
2826
2927 Jex .create ()
30- .plugin (webRoot )
31- .plugin (webBundle )
3228 .plugin (robots )
29+ .plugin (webBundle )
30+ .plugin (webRoot )
3331 .jsonService (new Jackson3JsonService ())
3432 .get ("/api/version" , new VersionHandler ())
3533 .post ("/api/json-validate" , new ValidationHandler ())
Original file line number Diff line number Diff line change @@ -17,6 +17,18 @@ tasks.register('build', Exec) {
1717 exclude ' dist' , ' node_modules' , ' bun.lockb'
1818 }. findAll())
1919 outputs. dir(' dist' )
20+
21+ // create index file
22+ doLast {
23+ def fileNames = []
24+ def distPath = file(' dist' ). toPath()
25+ fileTree(' dist' ). each {
26+ fileNames. add distPath. relativize(it. toPath())
27+ }
28+ print fileNames
29+ def indexFile = distPath. resolve(' files.index' ). toFile()
30+ indexFile. text = fileNames. join(System . lineSeparator())
31+ }
2032}
2133
2234artifacts {
You can’t perform that action at this time.
0 commit comments