Skip to content

Return HTML Content #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed

Conversation

ritasker
Copy link
Member

@ritasker ritasker commented Jul 30, 2018

A work in progress, hacked some code together over the weekend to get carter returning html.

Update

Added support for multiple view engines by creating interfaces.
Made the view locations configurable.

Relies on CarterCommunity/Carter#127 to resolve the module name.

* Add support for multiple view engines
* Make the view locations configurable
public static class ResponseExtensions
{
public static async Task AsHtml(this HttpResponse response, string view, object obj, CancellationToken cancellationToken = default)
{
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of passing the view name explicitly, it would be good to have some sensible defaults based on the route structure (somehow). As it stands, content negotiation is essentially impossible

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'm open to ideas here. At the moment I am using the ViewModel name if no view name has been passed in.

https://github.com/CarterCommunity/Carter.HtmlNegotiator/pull/2/files#diff-62bb90acb6596f2418415db11902ef68R57

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been wondering if named routes are a way to go or not, can't make my mind up and it's 11:05pm.

If we did add named routes in some fashion, it would help close off CarterCommunity/Carter#79 as well

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also wonder if we should have the ability to have a layout, and then render views inside the parent layout. 🤔

I know I'm essentially describing Razor in parts here

@ritasker ritasker changed the title WIP: Return HTML Content Return HTML Content Aug 23, 2018
@ritasker
Copy link
Member Author

superseded by #3

@ritasker ritasker closed this Feb 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants