Skip to content

Commit 7fa041a

Browse files
committed
Upgrade to latest convex version and make some updates
1 parent 187d74c commit 7fa041a

22 files changed

+358
-625
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Convex + Hono HTTP Endpoints
22

33
This example demonstrates how to use Convex
4-
[HTTP endpoints](https://docs.convex.dev/using/http-endpoints) with [Hono](https://hono.dev/).
4+
[HTTP actions](https://docs.convex.dev/using/http-endpoints) with [Hono](https://hono.dev/) to build a public HTTP API.
55

6-
This is based off of the [Convex HTTP endpoints demo](https://github.com/get-convex/convex-demos/tree/main/http) and uses the [honoWithConvex.ts](https://github.com/get-convex/convex-helpers/blob/main/convex/lib/honoWithConvex.ts) helper with this [accompanying post](https://stack.convex.dev/hono-with-convex)
6+
This is based off of the [Convex HTTP actions demo](https://github.com/get-convex/convex-demos/tree/main/http) and uses the [honoWithConvex.ts](https://github.com/get-convex/convex-helpers/blob/main/convex/lib/honoWithConvex.ts) helper with this [accompanying post](https://stack.convex.dev/hono-with-convex)
77

88
## Running the App
99

@@ -18,7 +18,7 @@ To call the endpoints (e.g. using `curl`):
1818

1919
```
2020
export DEPLOYMENT_NAME="tall-sheep-123"
21-
curl "https://$DEPLOYMENT_NAME.convex.site/listMessages/456"
21+
curl "https://$DEPLOYMENT_NAME.convex.site/api/listMessages/456"
2222
curl -d '{ "author": "User 456", "body": "Hello world" }' \
23-
-H 'content-type: application/json' "https://$DEPLOYMENT_NAME.convex.site/postMessage"
23+
-H 'content-type: application/json' "https://$DEPLOYMENT_NAME.convex.site/api/postMessage"
2424
```

convex/_generated/api.d.ts

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,41 @@
11
/* eslint-disable */
22
/**
3-
* Generated API.
3+
* Generated `api` utility.
44
*
55
* THIS CODE IS AUTOMATICALLY GENERATED.
66
*
7-
* Generated by convex@0.13.0.
8-
* To regenerate, run `npx convex codegen`.
7+
* Generated by convex@0.19.0.
8+
* To regenerate, run `npx convex dev`.
99
* @module
1010
*/
1111

12-
import type { ApiFromModules } from "convex/api";
12+
import type {
13+
ApiFromModules,
14+
FilterApi,
15+
FunctionReference,
16+
} from "convex/server";
1317
import type * as http from "../http";
1418
import type * as lib_honoWithConvex from "../lib/honoWithConvex";
15-
import type * as listMessages from "../listMessages";
16-
import type * as sendMessage from "../sendMessage";
19+
import type * as messages from "../messages";
1720

1821
/**
19-
* A type describing your app's public Convex API.
22+
* A utility for referencing Convex functions in your app's API.
2023
*
21-
* This `API` type includes information about the arguments and return
22-
* types of your app's query and mutation functions.
23-
*
24-
* This type should be used with type-parameterized classes like
25-
* `ConvexReactClient` to create app-specific types.
24+
* Usage:
25+
* ```js
26+
* const myFunctionReference = api.myModule.myFunction;
27+
* ```
2628
*/
27-
export type API = ApiFromModules<{
29+
declare const fullApi: ApiFromModules<{
2830
http: typeof http;
2931
"lib/honoWithConvex": typeof lib_honoWithConvex;
30-
listMessages: typeof listMessages;
31-
sendMessage: typeof sendMessage;
32+
messages: typeof messages;
3233
}>;
34+
export declare const api: FilterApi<
35+
typeof fullApi,
36+
FunctionReference<any, "public">
37+
>;
38+
export declare const internal: FilterApi<
39+
typeof fullApi,
40+
FunctionReference<any, "internal">
41+
>;

convex/_generated/api.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/* eslint-disable */
2+
/**
3+
* Generated `api` utility.
4+
*
5+
* THIS CODE IS AUTOMATICALLY GENERATED.
6+
*
7+
* Generated by [email protected].
8+
* To regenerate, run `npx convex dev`.
9+
* @module
10+
*/
11+
12+
import { anyApi } from "convex/server";
13+
14+
/**
15+
* A utility for referencing Convex functions in your app's API.
16+
*
17+
* Usage:
18+
* ```js
19+
* const myFunctionReference = api.myModule.myFunction;
20+
* ```
21+
*/
22+
export const api = anyApi;
23+
export const internal = anyApi;

convex/_generated/dataModel.d.ts

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
*
55
* THIS CODE IS AUTOMATICALLY GENERATED.
66
*
7-
* Generated by convex@0.13.0.
8-
* To regenerate, run `npx convex codegen`.
7+
* Generated by convex@0.19.0.
8+
* To regenerate, run `npx convex dev`.
99
* @module
1010
*/
1111

12-
import type { DataModelFromSchemaDefinition } from "convex/schema";
12+
import type { DataModelFromSchemaDefinition } from "convex/server";
1313
import type { DocumentByName, TableNamesInDataModel } from "convex/server";
14-
import { GenericId, GenericIdConstructor } from "convex/values";
14+
import type { GenericId } from "convex/values";
1515
import schema from "../schema";
1616

1717
/**
@@ -37,28 +37,13 @@ export type Doc<TableName extends TableNames> = DocumentByName<
3737
*
3838
* Documents can be loaded using `db.get(id)` in query and mutation functions.
3939
*
40-
* **Important**: Use `myId.equals(otherId)` to check for equality.
41-
* Using `===` will not work because two different instances of `Id` can refer
42-
* to the same document.
40+
* IDs are just strings at runtime, but this type can be used to distinguish them from other
41+
* strings when type checking.
4342
*
4443
* @typeParam TableName - A string literal type of the table name (like "users").
4544
*/
4645
export type Id<TableName extends TableNames> = GenericId<TableName>;
4746

48-
/**
49-
* An identifier for a document in Convex.
50-
*
51-
* Convex documents are uniquely identified by their `Id`, which is accessible
52-
* on the `_id` field. To learn more, see [Document IDs](https://docs.convex.dev/using/document-ids).
53-
*
54-
* Documents can be loaded using `db.get(id)` in query and mutation functions.
55-
*
56-
* **Important**: Use `myId.equals(otherId)` to check for equality.
57-
* Using `===` will not work because two different instances of `Id` can refer
58-
* to the same document.
59-
*/
60-
export declare const Id: GenericIdConstructor<TableNames>;
61-
6247
/**
6348
* A type describing your Convex data model.
6449
*

convex/_generated/dataModel.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

convex/_generated/react.d.ts

Lines changed: 0 additions & 176 deletions
This file was deleted.

0 commit comments

Comments
 (0)