Skip to content
Mathias edited this page Jul 26, 2011 · 7 revisions

The spray source code repository contains a folder calles spray-examples that contains a number of example projects demonstrating different aspects of spray-server.

Calculator Example

This example defines a simple REST service offering basic calculations. This is its service definition.

Markdown-Server Example

This examples shows how spray can be used to serve up static files from JAR resources.

Its MarkdownService trait defines a custom media type for markdown files that are being served under the "/doc" path from a JAR resource "directory". The example uses a simple response transformation to convert content with the "text/x-markdown" type to HTML using pegdown.

Stopwatch Example

The Stopwatch example is a somewhat more elaborate example demonstrating, among other things, custom marshallers and method tunneling via query parameters. This is its main service definition.

If you have a particularly clever example for a spray-server service we'd be more than happy to include it (as is the case with all contributions).

Clone this wiki locally