Swagger UI

Using JsonServiceClient in Web Pages

Update your App's TypeScript DTOs and compile to JS (requires TypeScript):

$ x scripts dtos

Including @servicestack/client & Typed DTOs

Create a basic UMD loader then include the UMD @servicestack/client library and dtos.js:

<script>
  var exports = { __esModule:true }, module = { exports:exports }
  function require(name) { return exports[name] || window[name] }
</script>
<script src="/js/servicestack-client.js"></script>
<script src="/dtos.js"></script>

We can then import the library and DTO types in the global namespace to use them directly:

Object.assign(window, exports) //import

var client = new JsonServiceClient()
client.get(new Hello({ name: name }))
    .then(function(r) {
        console.log(r.result)
    })

Using @servicestack/client in npm projects

$ npm install @servicestack/client
import { JsonServiceClient } from '@servicestack/client'

let client = new JsonServiceClient()
let response = await client.get(new Hello({ name }))

Typed DTOs generated using TypeScript Add ServiceStack Reference