parent
9150b2e56b
commit
2d71b7def7
|
@ -0,0 +1,13 @@
|
||||||
|
# tRPC Adapter Middleware for Hono
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```ts
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## Author
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT
|
|
@ -0,0 +1 @@
|
||||||
|
module.exports = require('../../jest.config.js')
|
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
"name": "@honojs/trpc-adapter",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"description": "tRPC Adapter Middleware for Hono",
|
||||||
|
"main": "dist/index.js",
|
||||||
|
"types": "dist/index.d.ts",
|
||||||
|
"files": [
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"test": "jest",
|
||||||
|
"build": "rimraf dist && tsc",
|
||||||
|
"prerelease": "yarn build && yarn test",
|
||||||
|
"release": "yarn publish"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"private": false,
|
||||||
|
"publishConfig": {
|
||||||
|
"registry": "https://registry.npmjs.org",
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/honojs/middleware.git"
|
||||||
|
},
|
||||||
|
"homepage": "https://honojs.dev",
|
||||||
|
"dependencies": {
|
||||||
|
"hono": "^2.2.5"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
import { Hono } from 'hono'
|
||||||
|
import { trpcAdapter } from '../src'
|
||||||
|
|
||||||
|
describe('tRPC Adapter Middleware', () => {
|
||||||
|
const app = new Hono()
|
||||||
|
|
||||||
|
app.use('/trpc/*', trpcAdapter())
|
||||||
|
app.get('/trpc', (c) => c.text('Here is dummy endpoint'))
|
||||||
|
|
||||||
|
it('Should return 200 response', async () => {
|
||||||
|
const res = await app.request('http://localhost/trpc')
|
||||||
|
expect(res).not.toBeNull()
|
||||||
|
expect(res.status).toBe(200)
|
||||||
|
})
|
||||||
|
})
|
|
@ -0,0 +1,7 @@
|
||||||
|
import type { Handler } from 'hono'
|
||||||
|
|
||||||
|
export const trpcAdapter = (): Handler => {
|
||||||
|
return async (_c, next) => {
|
||||||
|
await next()
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"extends": "../../tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"rootDir": "./src",
|
||||||
|
"outDir": "./dist",
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src/**/*.ts"
|
||||||
|
],
|
||||||
|
}
|
Loading…
Reference in New Issue