SaturnFramework / Saturn

Opinionated, web development framework for F# which implements the server-side, functional MVC pattern
https://saturnframework.org
MIT License
708 stars 108 forks source link

Add support for router-less applications #191

Closed isaacabraham closed 5 years ago

isaacabraham commented 5 years ago

This might be going "against" the core of Saturn, but if you want to use Saturn as a "lightweight" way to create ASP .NET Core applications, using only the application { } type and without routing, you can't - Saturn throws an error if you create an app without routes with the error Router needs to be defined in Saturn application.

It would be great to remove this error (perhaps replaced with a warning that could be suppressed with an explicit no_routes flag inside the application { }?) for cases where there is no HTTP routing e.g. https://github.com/protobuf-net/protobuf-net.Grpc

isaacabraham commented 5 years ago

Indeed this suggests that perhaps in a perfect world Saturn's application { } abstraction could be a separate package to Saturn's routing capabilities (which are more closely coupled to Giraffe etc.).

Krzysztof-Cieslak commented 5 years ago

I don't think I'd want to do separate package for application - it seems that it would be really niche use case. But we definitely can:

  1. Change application to support scenarios without routing.
  2. Provide Saturn.Extensions.Grpc pacakge to provide helpers discussed https://github.com/CompositionalIT/protobuf-net.Grpc/pull/1
Krzysztof-Cieslak commented 5 years ago

Fixed by https://github.com/SaturnFramework/Saturn/commit/8e5499e24425ca7a67cb3826620ce272d8f92c8d