Skip to content

General feedback on the application model #43

@mikkelhegn

Description

@mikkelhegn

When looking at the samples, one things that comes to my mind is

  • Use DI. Statics are an anti-pattern in .NET. E.g. Inject HttpOutbound
  • Routing would be great, just like we have with minimal APIs or MVC controllers. Currently we do
        if (request.Url.StartsWith("/outbound"))
        {
            return UseOutboundHttp(request);
        }
        return request.Url switch
        {
            "/redis" => UseRedis(request),
            "/pg" => UsePostgresQuery(request),
            "/pgins" => UsePostgresExec(request),
            _ => EchoRequestInfo(request),
        };
  • Model binding. .NET devs love (and need ;-)) model bindings, not just strings.
  • Return messages. Currently we need to do clumsy things, like
return new HttpResponse
        {
            StatusCode = System.Net.HttpStatusCode.OK,
            Headers = new Dictionary<string, string>
            {
                { "Content-Type", "text/html" },
            },
            BodyAsString = html,
        };
  • Would there be a way to not have a new, custom programming model, but rather integrate e.g. with minimal APIs?

From: https://discord.com/channels/926888690310053918/1050347475287945246/1050382904909381652

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions