Question

I'm investigating whether WebSharper can be used to build a ReSTful API that supports content negotiation. I was hoping that it would support something similar to the Web API model, whereby the controller returns a resource that is subsequently converted to the correct representation based on the request's accept header. However, it appears that the header info is only available to the Router, which maps the request to an Action, and then the Controller is responsible for converting the Action into some Content (i.e. a representation). This suggests that I would need a separate Action for each representation of the resource, which feels ugly.

Am I missing something here, or is WebSharper meant to be "MVC done right" and is not intended for this use case?

Was it helpful?

Solution

As expected, I was missing something. The details are here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top