File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 11import { headers } from "./headers.ts" ;
22import handler from "./utils.ts" ;
33
4+ const urlBase = Deno . env . get ( "URL_BASE" ) ? Deno . env . get ( "URL_BASE" ) : "" ;
45const { fetchFromSupabase } = handler ( ) ;
56
67export default async ( request : Request ) : Promise < Response > => {
@@ -11,7 +12,12 @@ export default async (request: Request): Promise<Response> => {
1112 `urls?order=created_at.desc&limit=${ count } ` ,
1213 { method : "GET" }
1314 ) ;
14- return new Response ( JSON . stringify ( data ) , { status : 200 , headers } ) ;
15+ const modifiedData = data . map ( ( item : any ) => ( {
16+ ...item ,
17+ short_url : `${ urlBase } /${ item . short_url } ` ,
18+ } ) ) ;
19+
20+ return new Response ( JSON . stringify ( modifiedData ) , { status : 200 , headers } ) ;
1521 } catch ( err ) {
1622 return new Response (
1723 JSON . stringify ( { error : "Internal server error" , details : err . message } ) ,
You can’t perform that action at this time.
0 commit comments