Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add samples and documentation #7

Open
nirvinm opened this issue Oct 19, 2019 · 8 comments
Open

Add samples and documentation #7

nirvinm opened this issue Oct 19, 2019 · 8 comments

Comments

@nirvinm
Copy link

nirvinm commented Oct 19, 2019

It is very hard to find documentation for Fable which negatively affects adopting it. Please add how-to guides for basic things like Fetch/Ajax.

@whitetigle
Copy link

Hi, thanks for taking time to evaluate Fable.

You should find relevant information in the official docs and official samples.

Just browse these links for more information:

@whitetigle
Copy link

Also please take a look at the tests in this repo you should find informative snippets. 😃

@fpellet
Copy link

fpellet commented Apr 18, 2020

I find it quite hard to use bindings and there are only simple examples.
No POST with data for example.

Since I wasted a lot of time migrating an old version of the fable, I would like to participate in the documentation and facilitate the learning of Fable.

Would you prefer to have a document in this repository or on the fable site?

@MangelMaxime
Copy link
Member

Hello, @fpellet thank you for proposing to help.

I am planning to rework all the Fable website and migrate it to a new website generator. So I think for now we could just add the documentation to the README.md file or in a DOCUMENTATION.md file.

@reinux
Copy link

reinux commented Jul 11, 2023

I'm actually not seeing any documentation regarding POST with data either in this repo or on Fable.

Maybe I'm missing something obvious, but I don't see anything regarding BodyInit or U3, and the link to the docs in the function (https://fable.io › docs › communicate › js-from-fable.html is just redirecting to home.

@MangelMaxime
Copy link
Member

MangelMaxime commented Jul 11, 2023

@reinux Fable documentation has been completely rewritten and during the process perhaps I missing adding a rediction for that page.

In any case, Fable documentation never contained documentation about Fable.Fetch itself.

Regarding sending a POST request you can check how it's done in JavaScript as Fable.Fetch is just a wrapper on top of the JS API.

It should look something like this:

open Fetch.Types
open Fable.Core.JsInterop

Fetch.fetch 
            "https://randomuser.me/api/" 
            [
                Method HttpMethod.POST
                Body (!^ "json")
            ]

@reinux
Copy link

reinux commented Jul 11, 2023

Thanks, yeah, I ended up figuring it out, though not with such tight syntax:

        Fetch.fetchUnsafe "/api/upload-document" [
          RequestProperties.Method HttpMethod.POST
          RequestProperties.Body (U3.Case2 form)
        ]

I'm assuming U3 and !^ are from Fable, since they seem to have to do with js interop. When you get a chance, could you please link me in the right direction?

Thanks!

@MangelMaxime
Copy link
Member

Here the section related to U2, U3, etc.

https://fable.io/docs/javascript/features.html#erased-unions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants