package main

import (
  "github.com/ricallinson/forgery"
  "github.com/spacedock-io/index/common"
)

func Routes(server *f.Server) {
  /*
    Library repository routes
   */
  server.Put("/v1/repositories/:repo/auth", LibraryAuth)
  server.Put("/v1/repositories/:repo", CreateLibrary)
  server.Delete("/v1/repositories/:repo", DeleteLibrary)
  server.Put("/v1/repositories/:repo/images", UpdateLibraryImage)
  server.Get("/v1/repositories/:repo/images", GetLibraryImage)

  /*
    User routes
   */
  server.Get("/v1/users", common.CheckAuth, Login)
  server.Post("/v1/users", CreateUser)
  server.Put("/v1/users/:username", common.CheckAuth, UpdateUser)

  /*
    User repository routes
   */
  server.Put("/v1/repositories/:namespace/:repo/auth", RepoAuth)
  server.Put("/v1/repositories/:namespace/:repo", CreateRepo)
  server.Delete("/v1/repositories/:namespace/:repo", DeleteRepo)
  server.Put("/v1/repositories/:namespace/:repo/images", UpdateUserImage)
  server.Get("/v1/repositories/:namespace/:repo/images", GetUserImage)

  // Search route
  server.Get("/v1/search", Search)
}

package main

import (
  "github.com/ricallinson/forgery"
  "github.com/spacedock-io/index/common"
)

func Routes(server *f.Server) {
  /*
    Library repository routes
   */
  server.Put("/v1/repositories/:repo/auth", LibraryAuth)
  server.Put("/v1/repositories/:repo", CreateLibrary)
  server.Delete("/v1/repositories/:repo", DeleteLibrary)
  server.Put("/v1/repositories/:repo/images", UpdateLibraryImage)
  server.Get("/v1/repositories/:repo/images", GetLibraryImage)

  /*
    User routes
   */
  server.Get("/v1/users", common.CheckAuth, Login)
  server.Post("/v1/users", CreateUser)
  server.Put("/v1/users", common.CheckAuth, UpdateUser)

  /*
    User repository routes
   */
  server.Put("/v1/repositories/:namespace/:repo/auth", RepoAuth)
  server.Put("/v1/repositories/:namespace/:repo", CreateRepo)
  server.Delete("/v1/repositories/:namespace/:repo", DeleteRepo)
  server.Put("/v1/repositories/:namespace/:repo/images", UpdateUserImage)
  server.Get("/v1/repositories/:namespace/:repo/images", GetUserImage)

  // Search route
  server.Get("/v1/search", Search)
}

--- 
+++ 
@@ -20,7 +20,7 @@
    */
   server.Get("/v1/users", common.CheckAuth, Login)
   server.Post("/v1/users", CreateUser)
-  server.Put("/v1/users", common.CheckAuth, UpdateUser)
+  server.Put("/v1/users/:username", common.CheckAuth, UpdateUser)
 
   /*
     User repository routes
Add :username param to PUT /v1/users/:username
