Skip to content

Commit aa400c6

Browse files
authored
Merge pull request #1 from zerowatt-io/james/config-host
use convex hostname from convex.json
2 parents bb8b226 + 7bb35fb commit aa400c6

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

hello-convex/README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,23 @@
22

33
This is an example of using the Convex SDK to build a basic counter application.
44

5-
The project is built with [React](https://reactjs.org/) and [TypeScript](https://www.typescriptlang.org/), bundled using [Vite](https://vitejs.dev/). It connects to a Convex server running at `localhost:8000` using the JavaScript SDK.
5+
The project is built with [React](https://reactjs.org/) and
6+
[TypeScript](https://www.typescriptlang.org/), bundled using
7+
[Vite](https://vitejs.dev/). It connects to a Convex server running at the host
8+
specified in `convex.json` using the JavaScript SDK.
69

710
## Running
811

9-
First run `npm install` to pull in the required dependencies including the Convex SDK/CLI.
12+
First run `npm install` to pull in the required dependencies including the
13+
Convex SDK/CLI.
1014

11-
The application assumes you have the Convex HTTP server running at `http://localhost:8000`.
15+
The application assumes you have the Convex HTTP server running at the given
16+
host.
1217

13-
Before you can interact with the Convex server you need to first register your `/convex` functions with `npx convex register`. This command should be re-run any time these functions are changed.
18+
Before you can interact with the Convex server you need to first register your
19+
`/convex` functions with `npx convex register`. This command should be re-run
20+
any time these functions are changed.
1421

15-
To run the app in development mode, use `npm run dev`. To build a production release, use `npm run build`. You can then view the static HTML using a simple web server with `npm run serve`.
22+
To run the app in development mode, use `npm run dev`. To build a production
23+
release, use `npm run build`. You can then view the static HTML using a simple
24+
web server with `npm run serve`.

hello-convex/src/App.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { useEffect, useState } from "react";
22
import { ConvexClient } from "convex-sdk";
33

4-
const convex = new ConvexClient("http://localhost:8000");
4+
import convexConfig from "../convex.json";
5+
const convex = new ConvexClient(convexConfig.host);
56

67
function Counter() {
78
const [counter, setCounter] = useState(0);

0 commit comments

Comments
 (0)