Last active
May 22, 2020 21:46
-
-
Save dkomanov/2ec34717a5e2641689a4aee80c64527c to your computer and use it in GitHub Desktop.
[writing-async-app-in-scala-part-1] regular sync web application example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def validateRequest(request: Request): Unit = { | |
require(request != null) | |
} | |
def regularRpcEndpoint(request: Request): Response = { | |
validateRequest(request) | |
if (!isPermittedViaRpc) { | |
throw new PermissionDeniedException("...") | |
} | |
val fromDb = retrieveFromDatabase(request.id) | |
val payload = convertPayloadFromDb(fromDb) | |
Response(payload) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment