Skip to content

Instantly share code, notes, and snippets.

@dkomanov
Last active May 22, 2020 21:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dkomanov/2ec34717a5e2641689a4aee80c64527c to your computer and use it in GitHub Desktop.
Save dkomanov/2ec34717a5e2641689a4aee80c64527c to your computer and use it in GitHub Desktop.
[writing-async-app-in-scala-part-1] regular sync web application example
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