diff --git a/README.md b/README.md
index 384e39c..f236a35 100644
--- a/README.md
+++ b/README.md
@@ -16,20 +16,44 @@ npm install react @tanstack/react-query@5 @comapeo/core-react @comapeo/core @com
Wrap your application with `ComapeoCoreProvider` and a React Query `QueryClientProvider`. You will need to be running an instance of [`@comapeo/map-server`](https://github.com/digidem/comapeo-map-server) and provide a `getMapServerBaseUrl` function that returns a Promise resolving to the base URL of your map server:
-```tsx
+In the server:
+
+```ts
import { ComapeoCoreProvider } from '@comapeo/core-react'
+import {
+ createComapeoCoreServer,
+ createComapeoServicesServer,
+} from '@comapeo/ipc/server.js'
import { createServer } from '@comapeo/map-server'
+
+const mapServer = createServer()
+const listenPromise = mapServer.listen()
+
+const servicesServer = createComapeoServicesServer(
+ {
+ mapServer: {
+ getBaseUrl: async () => {
+ const { localPort } = await listenPromise()
+ return `http://localhost:${localPort}`
+ },
+ },
+ },
+ port,
+)
+```
+
+In the client:
+
+```tsx
+import {
+ createComapeoCoreClient,
+ createComapeoServicesClient,
+} from '@comapeo/ipc/client.js'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
const queryClient = new QueryClient()
-const server = createServer()
-const listenPromise = server.listen()
-
-const getMapServerBaseUrl = async () => {
- const { localPort } = await listenPromise
- return new URL(`http://localhost:${localPort}/`)
-}
+const servicesClient = createComapeoServicesClient(port)
function App() {
return (
@@ -37,7 +61,7 @@ function App() {
diff --git a/docs/API.md b/docs/API.md
index eafd3e1..3094c74 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -1462,7 +1462,7 @@ function SentShareStatus({ shareId }: { shareId: string }) {
| Type | Type |
| ---------- | ---------- |
-| `MapServerApiOptions` | `{ getBaseUrl(): Promise /** * We assume the passed fetch implementation will only accept a `string` as * input, not a `URL` or `Request`, because right now the expo/fetch * implementation will only accept a `string`. Adding this restriction will * catch potential issues if we try to pass a URL in our code. Can be relaxed * when https://github.com/expo/expo/issues/43193 is fixed upstream. */ fetch?(input: string, options?: RequestInit): Promise }` |
+| `MapServerApiOptions` | `{ getBaseUrl(): Promise /** * We assume the passed fetch implementation will only accept a `string` as * input, not a `URL` or `Request`, because right now the expo/fetch * implementation will only accept a `string`. Adding this restriction will * catch potential issues if we try to pass a URL in our code. Can be relaxed * when https://github.com/expo/expo/issues/43193 is fixed upstream. */ fetch?(input: string, options?: RequestInit): Promise }` |
### MapServerApi
diff --git a/src/contexts/ComapeoCore.ts b/src/contexts/ComapeoCore.ts
index ecfaf18..493436b 100644
--- a/src/contexts/ComapeoCore.ts
+++ b/src/contexts/ComapeoCore.ts
@@ -5,7 +5,7 @@ import { MapServerProvider, type MapServerProviderProps } from './MapServer.js'
type ComapeoCoreProviderProps = ClientApiProviderProps &
Omit & {
- getMapServerBaseUrl(): Promise
+ getMapServerBaseUrl(): Promise
}
export function ComapeoCoreProvider({
diff --git a/src/contexts/MapServer.ts b/src/contexts/MapServer.ts
index 98c4015..50b3dc5 100644
--- a/src/contexts/MapServer.ts
+++ b/src/contexts/MapServer.ts
@@ -22,7 +22,7 @@ import {
} from './MapShares.js'
export type MapServerApiOptions = {
- getBaseUrl(): Promise
+ getBaseUrl(): Promise
/**
* We assume the passed fetch implementation will only accept a `string` as
* input, not a `URL` or `Request`, because right now the expo/fetch
diff --git a/test/helpers/react.tsx b/test/helpers/react.tsx
index 3ca77aa..4f95a83 100644
--- a/test/helpers/react.tsx
+++ b/test/helpers/react.tsx
@@ -12,7 +12,7 @@ export function createWrapper({
}: {
clientApi?: ComapeoCoreClientApi
queryClient?: QueryClient
- getMapServerBaseUrl?: () => Promise
+ getMapServerBaseUrl?: () => Promise
} = {}) {
return ({ children }: PropsWithChildren) => {
return (