Re:ASP.NET Core with Angular2 – Tutorial
by piaste on Tuesday September 27, 2016 @11:05AM
(#12590112)
A pretty straightforward solution is to have all your extensible options, etc., but also provide a few static objects with all options set to a working default. Use those objects for the hello world, or change the options you need to change and ONLY those options - no boilerplate.
Suave.io [0] does this very well I think. The hello world is:
open Suave
startWebServer defaultConfig (Successful.OK "Hello World!")
and as you write your application you can edit the configuration and routes as you go: open Suave
let myConfig = { defaultConfig with logger = myCustomLogger
homeFolder = HOME_PATH }
let myRoutes = choose [ path "/helloWorld" (Successful.OK "Hello World!")
pathScan "/hello/%s" (Successful.OK << CreateCustomGreeting) ]
startWebServer myConfig myRoutes
[0] http://www.suave.io
But Angular 2 is not designed to be scaled down that far, and making it friendly for that use would probably mean that other things became more complex.