14 ms·
In .net 6 you just run the command - dotnet new web then type dotnet run and you have a web app running. If you'd like to edit Program.cs with notepad or w
by nightski 5y ago
In .net 6 you just run the command -
dotnet new web
then type
dotnet run
and you have a web app running.
If you'd like to edit Program.cs with notepad or w/e (the default text is below, which is incredibly simple).
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.MapGet("/", () => "Hello World!");
app.Run();
- 3np 5y agoRight. I don't know if this changed significantly with 6, but my experience from previous versions have been that as soon as you start adding things like caches, authentication middleware that interacts with certain other components, or rewrite requests or responses in other ways it soon becomes a goose chase across the web and incomplete documentation. This is what comes to mind to me from GP's mention of crazy abstraction mazes.
- GordonS 5y agoA lot of this stuff was fiddly a long time back, before dotnet core, but it's all pretty sweet these days. For example, `AddMemoryCache() ` gives you a memory cache with the default settings - or you can change them by using the options argument. Request rewriting is really simple too, and even authentication is relatively straightforward. I get what you mean about "crazy abstraction mazes", but thankfully over the past few years we've been trending away from the madness of ludicrous inheritance hierarchies that were sold as "clean code" and dogmatically hoovered up by junior devs (including me, once upon a time!).
- thrower123 5y agoIt does get a little complicated when you try adding in the middleware components, and it doesn't Just Work. Frequently then you end up at some GitHub readme file as the only documentation (for first-party Microsoft components) with some very brief examples, maybe with some samples that don't quite show how you'd want to do what you want to do. Then you start digging in the source code and learning how the guts of aspnet core work. I would agree that bailing on dogmatic 2000s OOP has been an improvement.
- pipeline_peak 5y agoI think The command and observer aspects of WPF are really elegant and OOP patterns certainly have their place. But app development isn’t a pretty place where time crunched developers are expected to carefully design complex data structures…..at all.
- bluefirebrand 5y agoHow much boilerplate and configuration does "dotnet new web" generate?
- nightski 5y agoThat was the entire source code. There is a project file, but it's incredibly simple and they are meant to be human consumed/edited nowadays.