diff options
| author | benj <benj@rse8.com> | 2026-04-10 11:13:34 +0800 |
|---|---|---|
| committer | benj <benj@rse8.com> | 2026-04-10 11:13:34 +0800 |
| commit | 493746b14c1251a45b061d2e3edd9160c929d2b9 (patch) | |
| tree | 1607cceb94c1aac1a17a01bb5c0d71b97342e892 /web/api | |
| parent | c041641634650c31e03c70dcad132fd94cb08e63 (diff) | |
| download | tidyindex-493746b14c1251a45b061d2e3edd9160c929d2b9.tar tidyindex-493746b14c1251a45b061d2e3edd9160c929d2b9.tar.gz tidyindex-493746b14c1251a45b061d2e3edd9160c929d2b9.tar.bz2 tidyindex-493746b14c1251a45b061d2e3edd9160c929d2b9.tar.lz tidyindex-493746b14c1251a45b061d2e3edd9160c929d2b9.tar.xz tidyindex-493746b14c1251a45b061d2e3edd9160c929d2b9.tar.zst tidyindex-493746b14c1251a45b061d2e3edd9160c929d2b9.zip | |
a basic ui and landing web interface for tidyindex.com
Diffstat (limited to 'web/api')
| -rw-r--r-- | web/api/.gitignore | 3 | ||||
| -rw-r--r-- | web/api/package.json | 20 | ||||
| -rw-r--r-- | web/api/src/index.ts | 20 | ||||
| -rw-r--r-- | web/api/tsconfig.json | 12 | ||||
| -rw-r--r-- | web/api/wrangler.toml | 31 |
5 files changed, 86 insertions, 0 deletions
diff --git a/web/api/.gitignore b/web/api/.gitignore new file mode 100644 index 0000000..a934447 --- /dev/null +++ b/web/api/.gitignore @@ -0,0 +1,3 @@ +.wrangler/ +.dev.vars +node_modules/ diff --git a/web/api/package.json b/web/api/package.json new file mode 100644 index 0000000..108f52b --- /dev/null +++ b/web/api/package.json @@ -0,0 +1,20 @@ +{ + "name": "@tidyindex/api", + "version": "0.0.0", + "private": true, + "type": "module", + "scripts": { + "dev": "wrangler dev", + "deploy": "wrangler deploy", + "check": "tsc --noEmit" + }, + "dependencies": { + "@tidyindex/core": "workspace:*", + "hono": "^4.6.0" + }, + "devDependencies": { + "@cloudflare/workers-types": "^4.20240925.0", + "typescript": "^5.6.0", + "wrangler": "^3.78.0" + } +} diff --git a/web/api/src/index.ts b/web/api/src/index.ts new file mode 100644 index 0000000..f30fda1 --- /dev/null +++ b/web/api/src/index.ts @@ -0,0 +1,20 @@ +import { Hono } from 'hono'; +import { CORE_VERSION } from '@tidyindex/core'; + +export interface Env { + // DATABASE_URL: string; + // KEY_CACHE: KVNamespace; + // ACCOUNT_METER: DurableObjectNamespace; +} + +const app = new Hono<{ Bindings: Env }>(); + +app.get('/', (c) => + c.json({ + name: 'tidyindex-api', + version: '0', + core: CORE_VERSION + }) +); + +export default app; diff --git a/web/api/tsconfig.json b/web/api/tsconfig.json new file mode 100644 index 0000000..7446044 --- /dev/null +++ b/web/api/tsconfig.json @@ -0,0 +1,12 @@ +{ + "extends": "../tsconfig.base.json", + "compilerOptions": { + "rootDir": "src", + "lib": ["ES2022"], + "types": ["@cloudflare/workers-types"], + "noEmit": true, + "jsx": "react-jsx", + "jsxImportSource": "hono/jsx" + }, + "include": ["src/**/*.ts"] +} diff --git a/web/api/wrangler.toml b/web/api/wrangler.toml new file mode 100644 index 0000000..29feff1 --- /dev/null +++ b/web/api/wrangler.toml @@ -0,0 +1,31 @@ +name = "tidyindex-api" +main = "src/index.ts" +compatibility_date = "2026-04-01" +compatibility_flags = ["nodejs_compat"] + +# Deploy the public route. Uncomment once the zone + DNS are wired up. +# workers_dev = false +# routes = [ +# { pattern = "api.tidyindex.com/*", zone_name = "tidyindex.com" } +# ] + +# Vars / secrets are loaded from .dev.vars locally and `wrangler secret put` +# in production. DATABASE_URL points at Neon (or Postgres via Hyperdrive). +# [vars] +# (none yet) + +# KV namespace for hashed-key → account cache. Create with: +# wrangler kv namespace create KEY_CACHE +# [[kv_namespaces]] +# binding = "KEY_CACHE" +# id = "REPLACE_ME" + +# Per-account rate-limit + usage buffer Durable Object. Wired up once +# the AccountMeter class lands. +# [[durable_objects.bindings]] +# name = "ACCOUNT_METER" +# class_name = "AccountMeter" +# +# [[migrations]] +# tag = "v1" +# new_classes = ["AccountMeter"] |
