Created
September 1, 2011 14:55
-
-
Save theburningmonk/1186335 to your computer and use it in GitHub Desktop.
An simple Nancy module which uses protobuf-net to serialize the response body
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
public class MainModule : NancyModule | |
{ | |
public MainModule() | |
{ | |
Post["/bindProtobuf"] = | |
x => | |
{ | |
User data = this.Bind(); | |
return new Response | |
{ | |
ContentType = "application/x-protobuf", | |
StatusCode = HttpStatusCode.OK, | |
Contents = stream => ProtoBuf.Serializer.Serialize(stream, data) | |
}; | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment