End HTTP request with error 400 if malformed/missing params
Move EitherT run into requiredLoggedInUser
Use requireLoggedInUser for appContext too

This is now possible as the login screen is simpler than earlier.
Since an AJAX HTTP error 403 just takes us to login, we don't need to
try to output reasonable JSON output from this entry point when the
user is not logged in.  Earlier client-side page render callbacks used
this output for deciding whether to output a login screen or not.
Add jsonResponse helper for functions that output JSON

Instead of explicitly calling writeJSON after each JSON handler, move
JSON response code into jsonResponse which will a) require a logged in
user and b) send a JSON response on successful completion of a query
action.