diff --git a/cloudflare/src/index.ts b/cloudflare/worker.ts similarity index 98% rename from cloudflare/src/index.ts rename to cloudflare/worker.ts index 5d7ef88..235c31e 100644 --- a/cloudflare/src/index.ts +++ b/cloudflare/worker.ts @@ -1,4 +1,4 @@ -import handler from '../../src' +import handler from '../src' export default { async fetch(request: Request) { diff --git a/cloudflare/wrangler.toml b/cloudflare/wrangler.toml index 643fb9a..19f155f 100644 --- a/cloudflare/wrangler.toml +++ b/cloudflare/wrangler.toml @@ -1,4 +1,4 @@ name = "suggestions" -main = "src/index.ts" +main = "worker.ts" compatibility_date = "2023-11-21" minify = true \ No newline at end of file diff --git a/netlify/netlify.toml b/netlify/netlify.toml deleted file mode 100644 index ede6822..0000000 --- a/netlify/netlify.toml +++ /dev/null @@ -1,6 +0,0 @@ -[dev] - autoLaunch = false - -[[edge_functions]] - path = "/" - function = "index" \ No newline at end of file diff --git a/netlify/netlify/edge-functions/index.ts b/netlify/netlify/edge-functions/index.ts deleted file mode 100644 index ab6dff5..0000000 --- a/netlify/netlify/edge-functions/index.ts +++ /dev/null @@ -1,24 +0,0 @@ -import type { Suggestions } from '../../../src/index.ts' -import handler from '../../../src/index.ts' - -export default async (request: Request): Promise => { - let result: Suggestions = [] - - try { - const params = new URL(request.url ?? '').searchParams - result = await handler({ - q: params.get('q') ?? '', - lang: params.get('l') ?? 'en', - with: params.get('with') ?? 'duckduckgo', - }) - } catch (err) { - console.warn(err) - } - - return Response.json(result, { - headers: { - 'Content-Type': 'application/json', - 'Access-Control-Allow-Origin': '*', - }, - }) -} diff --git a/netlify/package.json b/netlify/package.json deleted file mode 100644 index 7535c57..0000000 --- a/netlify/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "netlify", - "private": true, - "type": "module", - "scripts": { - "deploy": "netlify deploy", - "dev": "netlify dev" - } -} diff --git a/netlify/tsconfig.json b/netlify/tsconfig.json deleted file mode 100644 index b025bfb..0000000 --- a/netlify/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "node", - "noEmit": true, - "strict": true, - "skipLibCheck": true, - "isolatedModules": true, - "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, - "allowImportingTsExtensions": true - } -}