comparison pkg/controllers/routes.go @ 1023:337a7f4c8a16

Add endpoint to list all or some import jobs. Unpaged path: /api/imports Paged path: /api/imports?offset=[0-9+]&limit=[0-9]+
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 24 Oct 2018 12:24:26 +0200
parents a244b18cb916
children 3de54d7b7d30
comparison
equal deleted inserted replaced
1022:74229d9f7028 1023:337a7f4c8a16
156 156
157 // Imports 157 // Imports
158 api.Handle("/imports/soundingresult", 158 api.Handle("/imports/soundingresult",
159 waterwayAdmin(http.HandlerFunc(importSoundingResult))).Methods(http.MethodPost) 159 waterwayAdmin(http.HandlerFunc(importSoundingResult))).Methods(http.MethodPost)
160 160
161 // Import queue
162 lsImports := waterwayAdmin(&JSONHandler{
163 Handle: listImports,
164 })
165
166 api.Handle("/imports", lsImports).
167 Methods(http.MethodGet).
168 Queries(
169 "offset", "{offset:[0-9]+}",
170 "limit", "{limit:[0-9]+}")
171
172 api.Handle("/imports", lsImports).
173 Methods(http.MethodGet)
174
161 // Token handling: Login/Logout. 175 // Token handling: Login/Logout.
162 api.HandleFunc("/login", login). 176 api.HandleFunc("/login", login).
163 Methods(http.MethodPost) 177 Methods(http.MethodPost)
164 api.Handle("/logout", auth.SessionMiddleware(http.HandlerFunc(logout))). 178 api.Handle("/logout", auth.SessionMiddleware(http.HandlerFunc(logout))).
165 Methods(http.MethodGet, http.MethodPost) 179 Methods(http.MethodGet, http.MethodPost)