diff --git a/src/controller.v b/src/controller.v index caea359..48aa469 100644 --- a/src/controller.v +++ b/src/controller.v @@ -2,7 +2,20 @@ module main import vweb -@[post] -pub fn (mut app App) signup() vweb.Result{ - return $vweb.html() +@['/signup'; post] +pub fn (mut app App) post_signup(username string, email string, password string) vweb.Result{ + app.service_add_user(username, email, password) or { + mut noti := Noti{ + status: "failure", + message: err.str() + } + return app.json(noti) + } + + noti := Noti{ + status: "success", + message: "User created successfully" + } + + return app.json(noti) } \ No newline at end of file