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?

有帮助吗?

解决方案

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top