routes_sms.ts 557 B

123456789101112131415161718192021
  1. import { Hono } from 'hono'
  2. import { SmsController } from './controllers/sms.ts'
  3. import type { MiddlewareHandler } from 'hono'
  4. export function createSmsRoutes(withAuth: MiddlewareHandler) {
  5. const router = new Hono()
  6. // 登录验证
  7. router.post('/login', SmsController.login)
  8. // 获取设备状态
  9. router.get('/status', withAuth, SmsController.getDeviceStatus)
  10. // 发送短信
  11. router.post('/send', withAuth, SmsController.sendSms)
  12. // 查询短信结果
  13. router.get('/result/:id', withAuth, SmsController.getSmsResult)
  14. return router
  15. }