refactor(coordinator & prover): RESTful API (#696)

Co-authored-by: georgehao <haohongfan@gmail.com>
Co-authored-by: HAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com>
This commit is contained in:
colin
2023-08-05 14:27:07 +08:00
committed by GitHub
parent b0b6a3db5e
commit 2a0c7ae6b5
69 changed files with 2727 additions and 15630 deletions

View File

@@ -0,0 +1,32 @@
package api
import (
"sync"
"gorm.io/gorm"
"scroll-tech/coordinator/internal/config"
)
var (
// GetTask the prover task controller
GetTask *GetTaskController
// SubmitProof the submit proof controller
SubmitProof *SubmitProofController
// HealthCheck the health check controller
HealthCheck *HealthCheckController
// Auth the auth controller
Auth *AuthController
initControllerOnce sync.Once
)
// InitController inits Controller with database
func InitController(cfg *config.Config, db *gorm.DB) {
initControllerOnce.Do(func() {
Auth = NewAuthController(db)
HealthCheck = NewHealthCheckController()
GetTask = NewGetTaskController(cfg, db)
SubmitProof = NewSubmitProofController(cfg, db)
})
}