chore: update example (#123)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Yusuke Wada · committed by GitHub · parent 9d41d00 · Browse files · 10 files·+24 added−33 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
10 files+24 added−33 removed
- other:+24 added−33 removed
Provenance
- Commit
4dd0ede- Tree
df81160- Author
Yusuke Wada <yusuke@kamawada.com>- Committer
GitHub <noreply@github.com>- Parent
9d41d00
10 files changed+24 added−33 removed
modified:examples/basic/package.json+2 added-2 removed
12 unmodified lines13141516171718191912 unmodified lines "dependencies": { "hono": "*" }, "devDependencies": { "wrangler": "^0.0.15" "wrangler": "^0.0.17" }}No newline at end of file}modified:examples/basic/wrangler.toml+2 added-5 removed
1212456345name = "ping"type = "webpack"name = "hono-example-basic"route = ''zone_id = 'b3177416e15dfbb73416bad76b828c49'usage_model = ''compatibility_flags = []zone_id = ''workers_dev = truecompatibility_date = "2021-12-15"modified:examples/blog/src/controller.ts+2 added-3 removed
11 unmodified lines1213141516161718192021202122232429 unmodified lines11 unmodified lines
export const create: Handler = async (c: Context) => { let newPost: Model.Post | undefined if (c.req.parsedBody) { const param = c.req.parsedBody as Model.Param const param: Model.Param = c.req.parsedBody newPost = await Model.createPost(param) } if (!newPost) { // Is 200 suitable? return c.json({ error: 'Can not create new post', ok: false }, 200) return c.json({ error: 'Can not create new post', ok: false }, 422) } return c.json({ post: newPost, ok: true }, 201)}
29 unmodified linesmodified:examples/blog/package.json+3 added-4 removed
10 unmodified lines111213141515161718192021222324252425272610 unmodified lines }, "author": "Yusuke Wada <yusuke@kamawada.com> (https://github.com/yusukebe)", "license": "MIT", "dependencies": { "hono": "^0.3.7" "hono": "^0.5.1" }, "devDependencies": { "@cloudflare/workers-types": "^3.3.1", "esbuild": "^0.14.21", "esbuild-jest": "^0.5.0", "jest": "^27.5.0", "jest-environment-miniflare": "^2.2.0", "jest-node-exports-resolver": "^1.1.5", "miniflare": "^2.3.0", "wrangler": "^0.0.15" "miniflare": "^2.3.0" }}}No newline at end of filemodified:examples/durable-objects/src/index.ts+2 added-2 removed
1123455678917 unmodified linesimport { Hono } from '../../../src/index'import { Hono } from 'hono'
export { Counter } from './counter'
declare module '../../../src/index' {declare module 'hono' { interface Env { COUNTER: DurableObjectNamespace }}17 unmodified linesmodified:examples/durable-objects/package.json+3 added-3 removed
9 unmodified lines101112131414151617171819199 unmodified lines }, "license": "MIT", "devDependencies": { "@cloudflare/workers-types": "^3.0", "wrangler": "^0.0.16" "wrangler": "^0.0.17" }, "dependencies": { "hono": "^0.3.7" "hono": "^0.5.1" }}No newline at end of file}modified:examples/jsx-ssr/src/index.tsx+2 added-6 removed
20 unmodified lines21 { id: '5', title: 'こんにちは', body: '昼からビールを飲みます' },22 ]23 24 // Logic25-const getPosts = () => {26- return posts27-}25+const getPosts = () => posts26 27 const getPost = (id: string) => {28 return posts.find((post) => post.id == id)29 }7 unmodified lines37 38 app.get('/post/:id{[0-9]+}', (c) => {39 const id = c.req.param('id')40 const post = getPost(id)43- if (!post) {44- return c.text('Not Found', 404)45- }41+ if (!post) return c.notFound()42 const html = render(<Page post={post} />)43 return c.html(html)44 })45 1 unmodified linemodified:examples/jsx-ssr/package.json+4 added-4 removed
8 unmodified lines9101112131314151617181718192021218 unmodified lines "publish": "wrangler publish dist/index.js" }, "license": "MIT", "dependencies": { "hono": "^0.3.7", "hono": "^0.5.1", "nano-jsx": "^0.0.29" }, "devDependencies": { "esbuild": "^0.14.20", "miniflare": "^2.2.0", "esbuild": "^0.14.25", "miniflare": "2.2.0", "wrangler": "^0.0.16" }}No newline at end of file}modified:examples/mustache/package.json+2 added-2 removed
7 unmodified lines8 "publish": "wrangler publish src/index.js"9 },10 "license": "MIT",11 "dependencies": {12- "hono": "^0.3.7",12+ "hono": "^0.5.1",13 "mustache": "^4.2.0"14 },15 "devDependencies": {16 "wrangler": "^0.0.16"17 }18-}18+}modified:examples/serve-static/package.json+2 added-2 removed
8 unmodified lines9 "publish": "wrangler publish src/index.js"10 },11 "license": "MIT",12 "dependencies": {13- "hono": "^0.3.7"13+ "hono": "^0.5.1"14 },15 "devDependencies": {16 "wrangler": "^0.0.16"17 }18-}18+}