Skip to content

Commit

Permalink
feat: add more parts
Browse files Browse the repository at this point in the history
  • Loading branch information
ankur-arch committed Jan 12, 2025
1 parent d23e308 commit 0876f9f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ import { withAccelerate } from "@prisma/extension-accelerate";
import { withPulse } from "@prisma/extension-pulse/workerd";
import { Hono } from "hono";
import { upgradeWebSocket } from "hono/cloudflare-workers";
import { requestId } from 'hono/request-id'

// Define environment bindings
type Bindings = {
Expand All @@ -201,6 +202,8 @@ type Bindings = {
};

const app = new Hono<{ Bindings: Bindings }>();

app.use('*', requestId())
```

### 3. Create a helper method to use `PrismaClient` in the application
Expand Down Expand Up @@ -241,7 +244,7 @@ app.get(
listeningToPulseStream = true;

const pointStream = await prisma.points.stream({
name: "points-stream",
name: `points-stream-${c.get('requestId')}`,
create: {},
});

Expand Down Expand Up @@ -353,7 +356,9 @@ Run the development server:
npm run dev
```

Visit `https://localhost:8787` to see your app in action. You should see a form and scatter plot updating in real time.
Visit `https://localhost:8787` to see your app in action. You should see a form where, if you input data, the scatter plot updates in real time:

![An demo of the app we built where a scatter plot updates in real-time](/img/guides/realtime-app-demo-ppg-cf-workers.gif)

## 5. Deploy the application to Cloudflare

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0876f9f

Please sign in to comment.