Skip to content

Instantly share code, notes, and snippets.

@adamw
Created February 18, 2019 12:50
Show Gist options
  • Save adamw/c107e5bcff8e4baae24f51a23a7eaf29 to your computer and use it in GitHub Desktop.
Save adamw/c107e5bcff8e4baae24f51a23a7eaf29 to your computer and use it in GitHub Desktop.
val bookBody = jsonBody[Book]
.description("The book")
.example(Book("Pride and Prejudice", "Novel", 1813))
val addBook: Endpoint[(Book, String), Unit, Boolean, Nothing] =
endpoint
.description("Adds a new book, if the user is authorized")
.post
.in("book" / "add")
.in(bookBody)
.in(header[String]("X-Auth-Token")
.description("The token is 'secret'"))
.out(plainBody[Boolean])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment