router.go 943 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package router
  2. import (
  3. apiv1 "auth-server/api/v1"
  4. "github.com/gin-gonic/gin"
  5. )
  6. func InitRouter() *gin.Engine {
  7. r := gin.New()
  8. InitMiddleware(r)
  9. r.StaticFile("/dr/", "./dist/index.html")
  10. r.Static("/dr/front/", "./dist/")
  11. // 注册路由
  12. v1 := r.Group("/dr/api/v1/")
  13. pubV1 := v1.Group("/pub")
  14. {
  15. pubV1.GET("/ping", apiv1.Ping)
  16. pubV1.GET("software_info", apiv1.SoftwareInfo)
  17. pubV1.POST("login", apiv1.Login)
  18. }
  19. authV1 := v1.Group("/auth")
  20. {
  21. configV1 := authV1.Group("/configs")
  22. {
  23. //configV1.GET("items", apiv1.GetConfigs)
  24. configV1.GET("options", apiv1.GetConfigOptions)
  25. configV1.POST("items", apiv1.UpdateConfigItems)
  26. }
  27. protocolV1 := authV1.Group("/protocol")
  28. {
  29. protocolV1.GET("patient_type", apiv1.GetPatientType)
  30. protocolV1.GET("body_part", apiv1.GetBodyPart)
  31. }
  32. dicomV1 := authV1.Group("/dicom")
  33. {
  34. dicomV1.GET("generate/instance_uid", apiv1.GenerateUniqueIdentifier)
  35. }
  36. }
  37. return r
  38. }