Closed boeremak closed 6 years ago
Hello there @boeremak
Unfortunately, Fable is not meant to be used as view engine library, because of this, it is not possible to use it such from the just the server as it requires mutiple processes (nodejs + dotnet) to run a full build. I think Blazor would be better suited as a "view engine" instead of Fable
Hi Zaid,
I was afraid that might be the case. Thanks for the information.
I am not sure to understand ?
In order to use Fable, you just need nodejs
. If you have a webserver that use nodejs
, then you can hook Fable code/function in it in order to generate HTML and serve it.
For example, Thoth docs site is generated using Fable SSR feature. For it the end point, is the file system but if you add it running on a nodejs
server it would be possible to request page and generate them on the fly with params etc.
I am using my own webserver and I was just wondering if it would be possible to load the compiled Fable file from disk and insert a datamodel into the compiled HTML, instead of using something like Fable remoting, and have it render on the server and sent to the client.
It is not clear how this would work, probably my lack of knowledge regarding Fable, or that it would even work.
Fable is about compiling F# to JavaScript so you are not executing Fable code.
You are running JavaScript.
In the case of Fable remoting you have a part running on .net on the server and on JavaScript in the browser.
Hi @boeremak! Did you check this great React SSR tutorial by @zaaack? It's not exactly Fable as the code will run fine in a netcore server, but it provides the same Fable.React API (so you can share the code if you also use Fable.React in the frontend) and it allows to easily "hydrate" the views in the frontend in case you need to attach events.
Hi @alfonsogarciacaro that post is what gave me the initial idea. :) I was not sure how it would all fit together or if it was possible at all.
It doesn't seem to work like I thought it would though. Seems like I need some other project to sneak Fable in. Keep up the good work though, it is really cool software.
Hi,
Maybe this is a dumb idea, but I was wondering if I could use Fable as a ViewEngine for my webserver. I have some simple HTML that would be nice to fill on the webserver instead of getting the values through AJAX calls.
It already seems to do a lot that I would need. The SSR stuff seems to do what I want but it is not clear to me how that would work.