Skip to content

Commit

Permalink
update deno-hono example with tutorial link and code improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
royalfig committed Nov 12, 2024
1 parent 671a812 commit a6fe1a1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion deno-hono/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This example app demonstrates how to use feature flags and A/B testing on a server-rendered landing page to test and deliver different experiences to users.

We offer a full tutorial in our docs.
We offer a [full tutorial in our docs](https://docs.growthbook.io/guide/deno-hono).

## Start the Server

Expand Down
10 changes: 5 additions & 5 deletions deno-hono/growthbookMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ export const growthbookMiddleware = createMiddleware<{
}>(async (c, next) => {
// Instantiate GrowthBook with your connection details
const gb = new GrowthBook({
apiHost: "https://cdn.growthbook.io",
clientKey: "sdk-QHVPAFSjyMARduDY",
apiHost: "https://cdn.growthbook.io", // Update with your API host
clientKey: "YOUR-SDK-KEY",
trackingCallback: (experiment, result) => {
console.log("Tracking", { experiment, result }); // Update function to send experiment exposure to your analytics platform
console.log("Experiment Viewed", { experiment, result }); // Update function to send experiment exposure to your analytics platform
},
});

Expand All @@ -25,14 +25,14 @@ export const growthbookMiddleware = createMiddleware<{
setCookie(c, "gb_uuid", uuid);
}

// Pass GrowthBook the ID and other attributes as need
// Pass GrowthBook the ID and other attributes as needed
gb.setAttributes({
id: uuid,
// ...
});

// Initialize GrowthBook
await gb.init({ timeout: 5000 });
await gb.init({ timeout: 1000 });

// Add the instance to the context
c.set("gb", gb);
Expand Down
2 changes: 1 addition & 1 deletion deno-hono/src/components/Hero.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Props } from "../../main.tsx";

export function Hero({ gb }: Props) {
const headline = gb?.getFeatureValue(
const headline = gb.getFeatureValue(
"headline",
"Revolutionize Your Finances with AI",
);
Expand Down

0 comments on commit a6fe1a1

Please sign in to comment.