You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I like that gin-gonic can produce several different types of output, such as json, yaml, xml, html template, string, etc. I would like to "detect" what the user wants by looking at the "Accept" header, and run the appropriate c.WHATEVER based on that.
For example, if someone is querying via API they may ask for json output, but if they are using a browser, we should send them a rendered template (html).
Some items, like "serverListCSV" will still send CSV as a file, but I feel like it would be useful to have the same endpoints (routes) and controllers but just send the "display" portion to another method that would smartly format it.
Before I try to create this myself, can someone tell me if there is already something like this, and what it would be called (view controller is what comes to mind), where I would pass it the context, data and possibly a default type, and have it detect and send the appropriate type. I have tried googling various terms, related, but have just been led astray or maybe I just didn't understand the results.
The text was updated successfully, but these errors were encountered:
Description
I like that gin-gonic can produce several different types of output, such as json, yaml, xml, html template, string, etc. I would like to "detect" what the user wants by looking at the "Accept" header, and run the appropriate c.WHATEVER based on that.
For example, if someone is querying via API they may ask for json output, but if they are using a browser, we should send them a rendered template (html).
Some items, like "serverListCSV" will still send CSV as a file, but I feel like it would be useful to have the same endpoints (routes) and controllers but just send the "display" portion to another method that would smartly format it.
Before I try to create this myself, can someone tell me if there is already something like this, and what it would be called (view controller is what comes to mind), where I would pass it the context, data and possibly a default type, and have it detect and send the appropriate type. I have tried googling various terms, related, but have just been led astray or maybe I just didn't understand the results.
The text was updated successfully, but these errors were encountered: