File tree Expand file tree Collapse file tree 5 files changed +12
-6
lines changed
Expand file tree Collapse file tree 5 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 1- import { headers } from "./headers.ts" ;
1+ import headers from "./headers.ts" ;
22import { fetchFromSupabase } from "./utils.ts" ;
33
44export default async ( request : Request ) : Promise < Response > => {
Original file line number Diff line number Diff line change @@ -5,3 +5,5 @@ export const headers = {
55 "Access-Control-Max-Age" : "86400" ,
66 "Content-Type" : "application/json" ,
77} ;
8+
9+ export default ( ) => headers ;
Original file line number Diff line number Diff line change 1- import { headers } from "./headers.ts" ;
1+ import headers from "./headers.ts" ;
22import { fetchFromSupabase } from "./utils.ts" ;
33
44export default async ( request : Request ) : Promise < Response > => {
Original file line number Diff line number Diff line change 11import { multiParser } from "https://deno.land/x/multiparser@0.114.0/mod.ts" ;
2- import { headers } from "./headers.ts" ;
2+ import headers from "./headers.ts" ;
33import { fetchFromSupabase , generateShortUrl } from "./utils.ts" ;
44
55export default async ( request : Request ) : Promise < Response > => {
66 try {
7- const form = await multiParser ( request ) ;
8- const url = form . fields . url ;
7+ const formData = await multiParser ( request ) ;
8+ const url = formData . fields . url ;
99
1010 if ( ! url ) {
1111 return new Response ( JSON . stringify ( { error : "No URL provided" } ) , {
Original file line number Diff line number Diff line change 11const SUPABASE_URL = Deno . env . get ( "SUPABASE_URL" ) ;
22const SUPABASE_KEY = Deno . env . get ( "SUPABASE_ANON_KEY" ) ;
3- const SUPABASE_TABLE = "urls" ;
43
54export async function fetchFromSupabase (
65 endpoint : string ,
@@ -20,3 +19,8 @@ export async function fetchFromSupabase(
2019export function generateShortUrl ( ) : string {
2120 return crypto . randomUUID ( ) . substring ( 0 , 7 ) ;
2221}
22+
23+ export default {
24+ fetchFromSupabase,
25+ generateShortUrl,
26+ } ;
You can’t perform that action at this time.
0 commit comments