Creates an API from the given service definition, with automatically generated endpoint fetch and WebSocket connect methods.
Use this to ship auto-generated API objects to internal or external teams so they have type safe access to your REST and WebSocket server.
The generated API can easily mocked by wrapping it in makeMockApi.
import {generateApi} from '@rest-vir/define-service';export const myApi = generateApi(myServiceDefinition);myApi.endpoints['/my-endpoint'].fetch();myApi.webSockets['/my-web-socket'].connect(); Copy
import {generateApi} from '@rest-vir/define-service';export const myApi = generateApi(myServiceDefinition);myApi.endpoints['/my-endpoint'].fetch();myApi.webSockets['/my-web-socket'].connect();
@rest-vir/define-service
Creates an API from the given service definition, with automatically generated endpoint fetch and WebSocket connect methods.
Use this to ship auto-generated API objects to internal or external teams so they have type safe access to your REST and WebSocket server.
The generated API can easily mocked by wrapping it in makeMockApi.