Created
February 4, 2014 17:20
-
-
Save jdegoes/8808245 to your computer and use it in GitHub Desktop.
A preview of the RedEyes web framework
This file contains hidden or 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
/* | |
* RedEyes generates rich descriptions of the API, as well as valid examples for | |
* all parameters (in this case, example header, query parameter, and content). | |
* | |
* The API can also be used to generate client libraries in a variety of languages. | |
* | |
* Service handlers are strongly-typed (e.g. retrieveEmployees expects an integer | |
* and a ModelDesc). Any errors in using the API automatically generate rich | |
* descriptions on what was expected. | |
*/ | |
val headers = contentType("application/json") <|> contentType("text/json") | |
val api = Handlers.retrieveEmployees <| GET >*> path("/employees/") >*> headers >*> queryInt("limit") <*> (contentText[ModelDesc] ^? "A filter on the employees to retrieve") | |
val documentation = describe(api).toMarkdown | |
val server = NioServerCompiler.compile(api) | |
server.run(config).unsafePerformIO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment