public UserModule(Authentication auth) : base("/API/User") { Get["/"] = _ => { return auth.Verify(Authentication.SessionIdFromRequest(Request)); }; Post["/"] = _ => { return auth.Register(new User(this.Bind<UserLogin>())); }; }
public MessageModule(Authentication auth) : base("/API/Message") { Post["/"] = _ => { User user = auth.Verify(Authentication.SessionIdFromRequest(Request)); if (user == null) { return HttpStatusCode.Unauthorized; } auth.Send(user, this.Bind<Message>()); return user; }; }