diff --git a/ThePlaceHolders b/ThePlaceHolders new file mode 100755 index 0000000..d394606 Binary files /dev/null and b/ThePlaceHolders differ diff --git a/server.go b/server.go index aaea1eb..408183e 100644 --- a/server.go +++ b/server.go @@ -8,8 +8,34 @@ import ( const ADDRESS = "127.0.0.1" const PORT = "8080" -func get_canvas(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, "test data") +type UserForm struct { + Email string + Password string +} + +func extract_user_data(r *http.Request) UserForm { + return UserForm{ + Email: r.FormValue("email"), + Password: r.FormValue("password"), + } +} + +func handle_login(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodPost { + return + } + data := extract_user_data(r) + fmt.Fprintln(w, data.Email) + fmt.Fprintln(w, data.Password) +} + +func handle_register(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodPost { + return + } + data := extract_user_data(r) + fmt.Fprintln(w, data.Email) + fmt.Fprintln(w, data.Password) } func main() { @@ -18,7 +44,8 @@ func main() { http.Handle("/", static_files) // Response generated by code - http.HandleFunc("/get-canvas", get_canvas) + http.HandleFunc("/handle-register", handle_register) + http.HandleFunc("/handle-login", handle_login) // Start web server at 127.0.0.1:8080 e := http.ListenAndServe(ADDRESS+":"+PORT, nil) diff --git a/static/register.html b/static/register.html index b42983a..eba8c7e 100644 --- a/static/register.html +++ b/static/register.html @@ -18,17 +18,17 @@
- +
- +
Already have an account? Click here to login.

- +