Skip to content

Commit 9cafa9f

Browse files
Copilothotlong
andcommitted
Fix object names and test Hono server functionality
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent eb2758f commit 9cafa9f

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

examples/integrations/hono-server/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,19 @@ The server will start on http://localhost:3005
2828
```bash
2929
curl -X POST http://localhost:3005/api/objectql \
3030
-H "Content-Type: application/json" \
31-
-d '{"op": "find", "object": "User", "args": {}}'
31+
-d '{"op": "find", "object": "user", "args": {}}'
3232
```
3333

3434
### REST API
3535
```bash
3636
# List all users
37-
curl http://localhost:3005/api/data/User
37+
curl http://localhost:3005/api/data/user
3838

3939
# Get a specific user
40-
curl http://localhost:3005/api/data/User/1
40+
curl http://localhost:3005/api/data/user/1
4141

4242
# Create a user
43-
curl -X POST http://localhost:3005/api/data/User \
43+
curl -X POST http://localhost:3005/api/data/user \
4444
-H "Content-Type: application/json" \
4545
-d '{"name": "John", "email": "john@example.com", "age": 30, "status": "active"}'
4646
```
@@ -50,8 +50,8 @@ curl -X POST http://localhost:3005/api/data/User \
5050
# List all objects
5151
curl http://localhost:3005/api/metadata/object
5252

53-
# Get User object schema
54-
curl http://localhost:3005/api/metadata/object/User
53+
# Get user object schema
54+
curl http://localhost:3005/api/metadata/object/user
5555
```
5656

5757
## Why Hono?

examples/integrations/hono-server/src/index.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ async function main() {
9393
<h2>Available APIs</h2>
9494
<div class="endpoint">
9595
<strong>JSON-RPC:</strong> <code>POST /api/objectql</code><br>
96-
Example: <code>{"op": "find", "object": "User", "args": {}}</code>
96+
Example: <code>{"op": "find", "object": "user", "args": {}}</code>
9797
</div>
9898
<div class="endpoint">
9999
<strong>REST:</strong> <code>GET /api/data/:object</code><br>
100-
Example: <code>GET /api/data/User</code>
100+
Example: <code>GET /api/data/user</code>
101101
</div>
102102
<div class="endpoint">
103103
<strong>Metadata:</strong> <code>GET /api/metadata/object</code><br>
@@ -107,9 +107,9 @@ async function main() {
107107
<h2>Test Commands</h2>
108108
<pre><code>curl -X POST http://localhost:${port}/api/objectql \\
109109
-H "Content-Type: application/json" \\
110-
-d '{"op": "find", "object": "User", "args": {}}'
110+
-d '{"op": "find", "object": "user", "args": {}}'
111111
112-
curl http://localhost:${port}/api/data/User
112+
curl http://localhost:${port}/api/data/user
113113
114114
curl http://localhost:${port}/api/metadata/object</code></pre>
115115
</body>
@@ -119,38 +119,38 @@ curl http://localhost:${port}/api/metadata/object</code></pre>
119119

120120
// Create some sample data
121121
const ctx = app.createContext({ isSystem: true });
122-
await ctx.object('User').create({
122+
await ctx.object('user').create({
123123
name: 'Alice',
124124
email: 'alice@example.com',
125125
age: 28,
126126
status: 'active'
127127
});
128-
await ctx.object('User').create({
128+
await ctx.object('user').create({
129129
name: 'Bob',
130130
email: 'bob@example.com',
131131
age: 35,
132132
status: 'active'
133133
});
134-
await ctx.object('User').create({
134+
await ctx.object('user').create({
135135
name: 'Charlie',
136136
email: 'charlie@example.com',
137137
age: 42,
138138
status: 'inactive'
139139
});
140140

141-
await ctx.object('Task').create({
141+
await ctx.object('task').create({
142142
title: 'Complete project',
143143
description: 'Finish the ObjectQL console',
144144
status: 'in-progress',
145145
priority: 'high'
146146
});
147-
await ctx.object('Task').create({
147+
await ctx.object('task').create({
148148
title: 'Write documentation',
149149
description: 'Document the new console feature',
150150
status: 'pending',
151151
priority: 'medium'
152152
});
153-
await ctx.object('Task').create({
153+
await ctx.object('task').create({
154154
title: 'Code review',
155155
description: 'Review pull requests',
156156
status: 'pending',

0 commit comments

Comments
 (0)