All files / src index.ts

100% Statements 7/7
100% Branches 0/0
100% Functions 1/1
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50                      53x   53x                             53x 18x     53x   53x                 53x            
import { OpenAPIHono, createRoute, z } from '@hono/zod-openapi'
import { swaggerUI } from '@hono/swagger-ui'
import { driveRouter } from './api/drive'
 
 
 
//Envをcloudflareの環境変数で型定義する
export type EnvHono = {
  Bindings: Env
}
 
const app = new OpenAPIHono<EnvHono>()
 
const rootRoute = createRoute({
  method: 'get',
  path: '/',
  responses: {
    200: {
      content: {
        'text/plain': {
          schema: z.string()
        }
      },
      description: 'Service status'
    }
  }
})
 
app.openapi(rootRoute, (c) => {
  return c.text('Google Drive API - File Upload Service')
})
 
app.route('/api/drive', driveRouter)
 
app.doc('/specification', {
  openapi: '3.0.0',
  info: {
    version: '1.0.0',
    title: 'Google Drive API - File Upload Service',
    description: 'API for uploading files to Google Drive with authentication'
  }
})
 
app.get('/doc', swaggerUI({ url: '/specification' }))
 
export default {
  fetch: app.fetch.bind(app)
}
export { app }