Skip to content

Commit 9745698

Browse files
committed
added admin app: fixes
1 parent 16e91b1 commit 9745698

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

admin/router.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ func NewRouter(context *Context) *Router {
1818
base := appbase.NewRouterBase(context.config.Config, []string{
1919
"/health",
2020
"/",
21-
"/static",
2221
})
2322
router := &Router{
2423
Router: base,
@@ -32,18 +31,17 @@ func NewRouter(context *Context) *Router {
3231

3332
// Admin API routes (protected by auth)
3433
adminAPI := engine.Group("/api/admin")
34+
adminAPI.Use(router.CorsMiddleware)
3535
reprocessingAPI := adminAPI.Group("/reprocessing")
36-
37-
reprocessingAPI.POST("/jobs", router.startReprocessingJob)
38-
reprocessingAPI.GET("/jobs", router.listReprocessingJobs)
39-
reprocessingAPI.GET("/jobs/:id", router.getReprocessingJob)
40-
reprocessingAPI.POST("/jobs/:id/pause", router.pauseReprocessingJob)
41-
reprocessingAPI.POST("/jobs/:id/resume", router.resumeReprocessingJob)
42-
reprocessingAPI.POST("/jobs/:id/cancel", router.cancelReprocessingJob)
36+
reprocessingAPI.Match([]string{"OPTIONS", "POST"}, "/jobs", router.startReprocessingJob)
37+
reprocessingAPI.Match([]string{"OPTIONS", "GET"}, "/jobs", router.listReprocessingJobs)
38+
reprocessingAPI.Match([]string{"OPTIONS", "GET"}, "/jobs/:id", router.getReprocessingJob)
39+
reprocessingAPI.Match([]string{"OPTIONS", "POST"}, "/jobs/:id/pause", router.pauseReprocessingJob)
40+
reprocessingAPI.Match([]string{"OPTIONS", "POST"}, "/jobs/:id/resume", router.resumeReprocessingJob)
41+
reprocessingAPI.Match([]string{"OPTIONS", "POST"}, "/jobs/:id/cancel", router.cancelReprocessingJob)
4342

4443
// Serve HTML interface for admin (no auth required for UI, auth handled via form)
4544
engine.GET("/", router.serveAdminHTML)
46-
engine.Static("/static", "./static")
4745

4846
return router
4947

0 commit comments

Comments
 (0)