aboutsummaryrefslogtreecommitdiff
path: root/src/user/routes.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/user/routes.go')
-rw-r--r--src/user/routes.go50
1 files changed, 43 insertions, 7 deletions
diff --git a/src/user/routes.go b/src/user/routes.go
index 791213d..09c53b2 100644
--- a/src/user/routes.go
+++ b/src/user/routes.go
@@ -1,6 +1,7 @@
package user
import (
+ "fmt"
"net/http"
"gitlab.com/alexkavon/newsstand/src/server"
@@ -8,16 +9,33 @@ import (
var Routes = server.Routes{
server.Route{
- Name: "Create",
- Method: "GET",
- Path: "/users/create",
- AuthRequired: false,
- HandlerFunc: Create,
+ Name: "Create",
+ Method: "GET",
+ Path: "/user/create",
+ HandlerFunc: Create,
+ },
+ server.Route{
+ Name: "Store",
+ Method: "POST",
+ Path: "/user",
+ HandlerFunc: Store,
+ },
+ server.Route{
+ Name: "LoginForm",
+ Method: "GET",
+ Path: "/user/auth",
+ HandlerFunc: LoginForm,
+ },
+ server.Route{
+ Name: "Authenticate",
+ Method: "POST",
+ Path: "/user/auth",
+ HandlerFunc: Authenticate,
},
server.Route{
Name: "Me",
Method: "GET",
- Path: "/users/me",
+ Path: "/user/me",
AuthRequired: true,
HandlerFunc: Show,
},
@@ -25,10 +43,28 @@ var Routes = server.Routes{
func Create(s *server.Server) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
- s.Ui.Render(w, "users/create", nil)
+ s.Ui.Render(w, "user/create", nil)
+ }
+}
+
+func Store(s *server.Server) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ r.ParseForm()
+ fmt.Println(r.PostForm)
+ s.Ui.Render(w, "core/messages", &struct{ Message string }{Message: "Congrats"})
}
}
+func LoginForm(s *server.Server) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ s.Ui.Render(w, "user/login", nil)
+ }
+}
+
+func Authenticate(s *server.Server) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {}
+}
+
func Show(s *server.Server) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {}
}