@@ -5,14 +5,14 @@ const PORT = 3033;
55const BASE_DIR = import . meta. dir ;
66
77serve ( {
8- port : PORT ,
9- async fetch ( req ) {
10- const url = new URL ( req . url ) ;
11- console . log ( `[Test Server] Request: ${ req . method } ${ url . pathname } ` ) ;
8+ port : PORT ,
9+ async fetch ( req ) {
10+ const url = new URL ( req . url ) ;
11+ console . log ( `[Test Server] Request: ${ req . method } ${ url . pathname } ` ) ;
1212
13- if ( url . pathname === "/" ) {
14- return new Response (
15- `
13+ if ( url . pathname === "/" ) {
14+ return new Response (
15+ `
1616 <!DOCTYPE html>
1717 <html>
1818 <head>
@@ -23,25 +23,25 @@ serve({
2323 </body>
2424 </html>
2525 ` ,
26- {
27- headers : { "Content-Type" : "text/html" } ,
28- }
29- ) ;
26+ {
27+ headers : { "Content-Type" : "text/html" } ,
3028 }
29+ ) ;
30+ }
3131
32- if ( url . pathname . startsWith ( "/dist/" ) ) {
33- const filePath = join ( BASE_DIR , url . pathname ) ;
34- console . log ( `[Test Server] Serving file: ${ filePath } ` ) ;
35- const file = BunFile ( filePath ) ;
36- if ( await file . exists ( ) ) {
37- return new Response ( file ) ;
38- }
39- console . error ( `[Test Server] File not found: ${ filePath } ` ) ;
40- return new Response ( `File not found: ${ filePath } ` , { status : 404 } ) ;
41- }
32+ if ( url . pathname . startsWith ( "/dist/" ) ) {
33+ const filePath = join ( BASE_DIR , url . pathname ) ;
34+ console . log ( `[Test Server] Serving file: ${ filePath } ` ) ;
35+ const file = BunFile ( filePath ) ;
36+ if ( await file . exists ( ) ) {
37+ return new Response ( file ) ;
38+ }
39+ console . error ( `[Test Server] File not found: ${ filePath } ` ) ;
40+ return new Response ( `File not found: ${ filePath } ` , { status : 404 } ) ;
41+ }
4242
43- return new Response ( "Not Found" , { status : 404 } ) ;
44- } ,
43+ return new Response ( "Not Found" , { status : 404 } ) ;
44+ } ,
4545} ) ;
4646
4747console . log ( `Test server running on http://localhost:${ PORT } ` ) ;
0 commit comments