CreatePublicHandler Creates the HTTP handler for the public API of a gateway server.
(sc *ServerContext)
| 121 | |
| 122 | // CreatePublicHandler Creates the HTTP handler for the public API of a gateway server. |
| 123 | func CreatePublicHandler(sc *ServerContext) http.Handler { |
| 124 | r, dbr, _ := createCommonRouter(sc, regularPrivs, publicServer) |
| 125 | |
| 126 | dbr.Handle("/_session", makeHandler(sc, publicPrivs, nil, nil, (*handler).handleSessionPOST)).Methods("POST") |
| 127 | dbr.Handle("/_session", makeHandler(sc, regularPrivs, nil, nil, (*handler).handleSessionDELETE)).Methods("DELETE") |
| 128 | // The routine below is part of the CouchDB REST API, users can't create DB's via the pblic API |
| 129 | // but if the client set the 'createTarget' property of the Replicatior SG should return HTTP status 412 |
| 130 | // if the db exists, and 403 if it doesn't. |
| 131 | r.Handle("/{targetdb:"+dbRegex+"}/", |
| 132 | makeHandler(sc, publicPrivs, nil, nil, (*handler).handleCreateTarget)).Methods("PUT") |
| 133 | |
| 134 | return wrapRouter(sc, regularPrivs, publicServer, r) |
| 135 | } |
| 136 | |
| 137 | // ////// ADMIN API: |
| 138 |
no test coverage detected