chore: add a skelton project for tRPC Adapter (#8)

pull/9/head @honojs/trpc-adapter@0.0.0
Yusuke Wada 2022-10-18 21:46:12 +09:00 committed by GitHub
parent 9150b2e56b
commit 2d71b7def7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 76 additions and 0 deletions

View File

@ -0,0 +1,13 @@
# tRPC Adapter Middleware for Hono
## Usage
```ts
```
## Author
## License
MIT

View File

@ -0,0 +1 @@
module.exports = require('../../jest.config.js')

View File

@ -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"
}
}

View File

@ -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)
})
})

View File

@ -0,0 +1,7 @@
import type { Handler } from 'hono'
export const trpcAdapter = (): Handler => {
return async (_c, next) => {
await next()
}
}

View File

@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "./src",
"outDir": "./dist",
},
"include": [
"src/**/*.ts"
],
}