Skip to content

Latest commit

 

History

History
25 lines (15 loc) · 450 Bytes

File metadata and controls

25 lines (15 loc) · 450 Bytes

MinimalRazorViews

Render Razor views from the new .net 6 minimal API.

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddRazorViews();

var app = builder.Build();

app.MapGet("/", () => Razor.View("TestView", new { Place = "Cape Town"}, app));

await app.RunAsync();

By default, Razor will look for Views in /Views

TestView example

@model dynamic

hello from @Model.Place