SAFE-Stack / SAFE-template

dotnet CLI template for SAFE project
MIT License
284 stars 88 forks source link

Remove Thoth from minimal template #424

Closed isaacabraham closed 3 years ago

isaacabraham commented 3 years ago

I think we should remove Thoth from the minimal template - or at least from the code sample (maybe just keep as a package reference?) - it's simply not required. We also no longer need the use the json combinator on the back end:

On the server

let webApp = router {
    get Route.hello (text "Hello from SAFE!")
}

On the client

...
let! response = Fetch.fetch Route.hello [] // Uses the built-in browser Fetch API that comes with Fable.
let! message = response.text()
header.innerText <- message
...
isaacabraham commented 3 years ago

I was wrong. That Fetch method is supplied by the Thoth package. But we don't need to include the Thoth-specific members in the code. In other words, I think that the sample above should still be used - it only uses the raw fetch method which is standard in Browsers rather than the Thoth-specific extensions.

theimowski commented 3 years ago

415 doesn't contain Thoth on Server side anymore in minimal template. AFAIK for Fetch API inside fable you either need to use Thoth.Fetch or Fable.Fetch package. I'll see if I can make #415 use the latter one

isaacabraham commented 3 years ago

Awesome. Could / should we use text rather than json (given that the message is actually just plain text)?