chore: move api to hono + cloudflare

This commit is contained in:
Rotimi Best
2025-01-18 11:13:05 +01:00
parent 76c28ec70e
commit 8eb9236bc0
12 changed files with 12849 additions and 9662 deletions
+33
View File
@@ -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
-7
View File
@@ -1,7 +0,0 @@
{
"deno.enablePaths": [
"./"
],
"deno.enable": true,
"editor.inlayHints.enabled": "off"
}
+6 -1
View File
@@ -1,3 +1,8 @@
```
deno task start
npm install
npm run dev
```
```
npm run deploy
```
-14
View File
@@ -1,14 +0,0 @@
{
"imports": {
"hono": "npm:hono",
"zod": "npm:zod",
"@hono/zod-validator": "npm:@hono/zod-validator"
},
"tasks": {
"start": "deno run --allow-net main.ts"
},
"compilerOptions": {
"jsx": "precompile",
"jsxImportSource": "hono/jsx"
}
}
-22
View File
@@ -1,22 +0,0 @@
{
"version": "4",
"specifiers": {
"jsr:@hono/hono@^4.6.4": "4.6.4",
"npm:hono@*": "4.6.5"
},
"jsr": {
"@hono/[email protected]": {
"integrity": "9bbd937653ab902405af33743561140f8883d27dc730eb9ceac665e2468c8bf6"
}
},
"npm": {
"[email protected]": {
"integrity": "sha512-qsmN3V5fgtwdKARGLgwwHvcdLKursMd+YOt69eGpl1dUCJb8mCd7hZfyZnBYjxCegBG7qkJRQRUy2oO25yHcyQ=="
}
},
"workspace": {
"dependencies": [
"jsr:@hono/hono@^4.6.4"
]
}
}
-7
View File
@@ -1,7 +0,0 @@
import { Hono } from 'hono';
const app = new Hono();
app.get('/', (c) => c.text('ClassroomIO API with Deno 😎!'));
Deno.serve({ port: 8787 }, app.fetch);
+14
View File
@@ -0,0 +1,14 @@
{
"name": "api",
"scripts": {
"dev": "wrangler dev",
"deploy": "wrangler deploy --minify"
},
"dependencies": {
"hono": "^4.6.16"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20250109.0",
"wrangler": "^3.101.0"
}
}
+9
View File
@@ -0,0 +1,9 @@
import { Hono } from 'hono'
const app = new Hono()
app.get('/', (c) => {
return c.text('Hello Hono!')
})
export default app
+17
View File
@@ -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"
},
}
+28
View File
@@ -0,0 +1,28 @@
name = "api"
main = "src/index.ts"
compatibility_date = "2025-01-16"
# compatibility_flags = [ "nodejs_compat" ]
# [vars]
# MY_VAR = "my-variable"
# [[kv_namespaces]]
# binding = "MY_KV_NAMESPACE"
# id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
# [[r2_buckets]]
# binding = "MY_BUCKET"
# bucket_name = "my-bucket"
# [[d1_databases]]
# binding = "DB"
# database_name = "my-database"
# database_id = ""
# [ai]
# binding = "AI"
# [observability]
# enabled = true
# head_sampling_rate = 1
+12720 -9611
View File
File diff suppressed because it is too large Load Diff
+22
View File
@@ -0,0 +1,22 @@
API
/courses
/courses/:courseId
/lessons
/lessons/:lessonId
/exercises
- courseId?: string
- lessonId?: string
/exercises/:exerciseId
/courses
/courses/:courseId/lessons
/courses/:courseId/lessons/:lessonId
/courses/:courseId/lessons/:lessonId/exercises
/courses/:courseId/lessons/:lessonId/exercises/:exerciseId
/organizations