Skip to content

Commit

Permalink
feat(trpc-server): bump up Hono version "v3" (#50)
Browse files Browse the repository at this point in the history
* feat(trpc-server): bump up Hono version "v3"

* add changeset
  • Loading branch information
yusukebe authored Feb 18, 2023
1 parent 118c43b commit b9e383f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/rich-seals-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hono/trpc-server': minor
---

feat: bump up Hono version "v3"
6 changes: 3 additions & 3 deletions packages/trpc-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
"homepage": "https://honojs.dev",
"peerDependencies": {
"@trpc/server": "^10.10.0",
"hono": "^2.7.5"
"hono": "3.*"
},
"devDependencies": {
"@trpc/server": "^10.10.0",
"hono": "^2.7.5",
"hono": "^3.0.0",
"zod": "^3.20.2"
},
"engines": {
"node": ">=16.0.0"
}
}
}
11 changes: 4 additions & 7 deletions packages/trpc-server/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
import type { AnyRouter } from '@trpc/server'
import type { FetchHandlerRequestOptions} from '@trpc/server/adapters/fetch'
import type { FetchHandlerRequestOptions } from '@trpc/server/adapters/fetch'
import { fetchRequestHandler } from '@trpc/server/adapters/fetch'
import type { MiddlewareHandler } from 'hono'

type tRPCOptions =
Omit<
FetchHandlerRequestOptions<AnyRouter>,
'req' | 'endpoint'
> & Partial<Pick<FetchHandlerRequestOptions<AnyRouter>, 'endpoint'>>
type tRPCOptions = Omit<FetchHandlerRequestOptions<AnyRouter>, 'req' | 'endpoint'> &
Partial<Pick<FetchHandlerRequestOptions<AnyRouter>, 'endpoint'>>

export const trpcServer = ({ endpoint = '/trpc', ...rest }: tRPCOptions): MiddlewareHandler => {
return async (c) => {
const res = fetchRequestHandler({
...rest,
endpoint,
req: c.req,
req: c.req.raw,
})
return res
}
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5212,7 +5212,7 @@ [email protected]:
resolved "https://registry.yarnpkg.com/hono/-/hono-3.0.0-rc.4.tgz#7bfe8c89d4b004ff90d587c8ba45279a175fbce7"
integrity sha512-76R3mb8kPeuD9TOmQ1WZi59w4QbpaUOlyX3wC7zQpt7IM7iFVBTxj2fpv++6ROPtd5iUBMCrmH/65ZrNXYYgmg==

hono@^2.6.1, hono@^2.7.5:
hono@^2.6.1:
version "2.7.5"
resolved "https://registry.yarnpkg.com/hono/-/hono-2.7.5.tgz#2b0c39d39a057575962a7025373be4304dedca9c"
integrity sha512-UYrhUT1Xtalh7Xw/YGXee25wlWMiVIRfr0FbAJMEMyRpX9TFZ/6JKmVdCK7ioRnhAw7PfWBasjSBhdNXQ8/okQ==
Expand Down

0 comments on commit b9e383f

Please sign in to comment.