The function actually exists only on server side, that’s what you get this error message when you compile the client side code.
You can call it in let%server
but not in let%client
or let%shared
.
On the documentation page, you can switch from server to client API.
What we usually do:
- declare the service in server section with
Eliom_service.create
- declare the client version with
let%client upload = ~%upload
- Then register the service in shared section with
My_app.register
Also: If you use Eliom_registration.Html.register
, you won’t be able to use the client/server features (like let%client
, ~%
, [%client ]
). If you want them, use your own registration module (My_app
in my example), created with functor Eliom_registration.App
. See the template application generated by Ocsigen Start for examples.
Vincent