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

Update fable-remoting.md #366

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion docs/recipes/client-server/fable-remoting.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ let myApi =
|> Remoting.buildProxy<IMyApi>
```

> Note: We have made your life easier by creating Metapackages which abstract some of this boilerplate. You can also create the client proxy like so:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove the above sample - there's no need for both. Or at the very least, put the preferred way (Api.makeProxy) first.

> ```fsharp
> open SAFE
>
> let myApi = Api.makeProxy<IMyApi> ()
> ```

#### 7. Make calls to the Server
Replace the following two lines in the `init` function in `Client.fs`:

Expand All @@ -74,4 +81,4 @@ let cmd = Cmd.OfAsync.perform myApi.hello () GotHello
```

## Done!
At this point, the app should work just as it did before. Now, expanding the API and adding a new endpoint is as easy as adding a new field to the API protocol we defined in `Shared.fs`, editing the `myApi` record in `Server.fs` with the implementation, and finally making calls from the proxy.
At this point, the app should work just as it did before. Now, expanding the API and adding a new endpoint is as easy as adding a new field to the API protocol we defined in `Shared.fs`, editing the `myApi` record in `Server.fs` with the implementation, and finally making calls from the proxy.