File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ const app = new Elysia()
38
38
}
39
39
} )
40
40
// Logging
41
- . onAfterResponse ( ( { path, request } ) => {
41
+ . onBeforeHandle ( ( { path, request } ) => {
42
42
console . log ( `🦊 ${ request . method } - ${ path } ` ) ;
43
43
} )
44
44
// Mesure request performance
@@ -57,11 +57,15 @@ const app = new Elysia()
57
57
. get (
58
58
"/:code" ,
59
59
async ( { params, set, redirect } ) => {
60
+ console . debug ( "Redirecting to" , params . code ) ;
60
61
const link = await getLink ( params . code ) ;
62
+ console . debug ( "Link found" , link ) ;
61
63
62
64
if ( ! link ) {
65
+ console . debug ( "Redirecting to" , NOT_FOUND_PAGE ) ;
63
66
return redirect ( `${ NOT_FOUND_PAGE } ?code=${ params . code } ` ) ;
64
67
} else {
68
+ console . debug ( "Redirecting to" , link . url ) ;
65
69
set . status = 301 ;
66
70
return redirect ( link . url ) ;
67
71
}
You can’t perform that action at this time.
0 commit comments