문제

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