Given a record or class-based IApi definition, one usually injects it into the server's routes via:
type IApi = {
[<Rpc>]
GetAllUsers : unit -> Async<DTO.User list>
}
let server : IApi = {
GetAllUsers = fun () -> ...
}
}
WebSharper.Core.Remoting.AddHandler typeof<IApi> server
This underneath the cover creates paths like /IApi/*, but the client is shielded from having to know the details and instead can just call using the established interface:
let server = Remote<IApi>
let doSomething() =
async {
let! hello = server.GetAllUsers()
printfn $"{hello}"
}
|> Async.StartImmediate
However, it would be beneficial to be able to customize how the various RPCs in the supplied service record/class are exposed.
Proposal: allow [<EndPoint>] on the RPC type to override the URL prefix for the service group (so changing /IApi/* to /api/*):
Given a record or class-based
IApi
definition, one usually injects it into the server's routes via:This underneath the cover creates paths like
/IApi/*
, but the client is shielded from having to know the details and instead can just call using the established interface:However, it would be beneficial to be able to customize how the various RPCs in the supplied service record/class are exposed.
Proposal: allow
[<EndPoint>]
on the RPC type to override the URL prefix for the service group (so changing/IApi/*
to/api/*
):