diff --git a/services/hoxy/.gitignore b/services/hoxy/.gitignore new file mode 100644 index 0000000..e319e06 --- /dev/null +++ b/services/hoxy/.gitignore @@ -0,0 +1,33 @@ +# prod +dist/ + +# dev +.yarn/ +!.yarn/releases +.vscode/* +!.vscode/launch.json +!.vscode/*.code-snippets +.idea/workspace.xml +.idea/usage.statistics.xml +.idea/shelf + +# deps +node_modules/ +.wrangler + +# env +.env +.env.production +.dev.vars + +# logs +logs/ +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +# misc +.DS_Store diff --git a/services/hoxy/README.md b/services/hoxy/README.md new file mode 100644 index 0000000..cc58e96 --- /dev/null +++ b/services/hoxy/README.md @@ -0,0 +1,8 @@ +``` +npm install +npm run dev +``` + +``` +npm run deploy +``` diff --git a/services/hoxy/package.json b/services/hoxy/package.json new file mode 100644 index 0000000..758eb6f --- /dev/null +++ b/services/hoxy/package.json @@ -0,0 +1,15 @@ +{ + "name": "hoxy", + "scripts": { + "dev": "wrangler dev", + "deploy": "wrangler deploy --minify", + "cf-typegen": "wrangler types --env-interface CloudflareBindings" + }, + "dependencies": { + "hono": "^4.7.4" + }, + "devDependencies": { + "@cloudflare/workers-types": "^4.20250312.0", + "wrangler": "^3.114.1" + } +} \ No newline at end of file diff --git a/services/hoxy/src/index.ts b/services/hoxy/src/index.ts new file mode 100644 index 0000000..1fa8da7 --- /dev/null +++ b/services/hoxy/src/index.ts @@ -0,0 +1,10 @@ +import { Hono } from 'hono' +// import { proxy } from 'hono/proxy' + +const app = new Hono<{ Bindings: CloudflareBindings }>() + +app.get('*', async (c) => { + return await c.env.IMAGE.fetch(c.req.raw) +}) + +export default app \ No newline at end of file diff --git a/services/hoxy/tsconfig.json b/services/hoxy/tsconfig.json new file mode 100644 index 0000000..4581f98 --- /dev/null +++ b/services/hoxy/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ESNext", + "module": "ESNext", + "moduleResolution": "Bundler", + "strict": true, + "skipLibCheck": true, + "lib": [ + "ESNext" + ], + "types": [ + "@cloudflare/workers-types/2023-07-01" + ], + "jsx": "react-jsx", + "jsxImportSource": "hono/jsx" + }, +} \ No newline at end of file diff --git a/services/hoxy/worker-configuration.d.ts b/services/hoxy/worker-configuration.d.ts new file mode 100644 index 0000000..36cef6b --- /dev/null +++ b/services/hoxy/worker-configuration.d.ts @@ -0,0 +1,5 @@ +// Generated by Wrangler by running `wrangler types --env-interface CloudflareBindings` + +interface CloudflareBindings { + IMAGE: Fetcher; +} diff --git a/services/hoxy/wrangler.jsonc b/services/hoxy/wrangler.jsonc new file mode 100644 index 0000000..20d68ab --- /dev/null +++ b/services/hoxy/wrangler.jsonc @@ -0,0 +1,47 @@ +/** + * For more details on how to configure Wrangler, refer to: + * https://developers.cloudflare.com/workers/wrangler/configuration/ + */ +{ + "$schema": "node_modules/wrangler/config-schema.json", + "name": "hoxy", + "main": "src/index.ts", + "compatibility_date": "2025-03-12", + "observability": { + "enabled": true + }, + /** + * Smart Placement + * Docs: https://developers.cloudflare.com/workers/configuration/smart-placement/#smart-placement + */ + // "placement": { "mode": "smart" }, + + /** + * Bindings + * Bindings allow your Worker to interact with resources on the Cloudflare Developer Platform, including + * databases, object storage, AI inference, real-time communication and more. + * https://developers.cloudflare.com/workers/runtime-apis/bindings/ + */ + + /** + * Environment Variables + * https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables + */ + // "vars": { "MY_VARIABLE": "production_value" }, + /** + * Note: Use secrets to store sensitive data. + * https://developers.cloudflare.com/workers/configuration/secrets/ + */ + + /** + * Static Assets + * https://developers.cloudflare.com/workers/static-assets/binding/ + */ + // "assets": { "directory": "./public/", "binding": "ASSETS" }, + + /** + * Service Bindings (communicate between multiple Workers) + * https://developers.cloudflare.com/workers/wrangler/configuration/#service-bindings + */ + "services": [{ "binding": "IMAGE", "service": "image", "environment": "production" }] +}