Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: openfeature examples, add README's for nextJS examples #626

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions examples/nextjs/app-router/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# DevCycle NextJS App Router Example
Run the command below to get started:

## Installation
Install all packages using `yarn` in the root directory.

## Running the example

* In `app/providers.tsx`, set `<DEVCYCLE_SERVER_SDK_KEY>` to the SDK Key for your environment.
You can find this under Settings / Environments on the DevCycle dashboard.
* Create a new feature on the dashboard. Update the `variableKey` in `app/page.tsx` to this value.
* If you added user targeting to your feature, update the `user_id` field in `app/page.tsx` based on your targeting rules.

You can now start the app by running:
```sh
yarn nx serve example-nextjs-app-router
```
Open [http://localhost:4200](http://localhost:4200) to view it in the browser.
18 changes: 18 additions & 0 deletions examples/nextjs/pages-router/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# DevCycle NextJS Pages Router Example
Run the command below to get started:

## Installation
Install all packages using `yarn` in the root directory.

## Running the example

* In `pages/_app.tsx`, set `<DEVCYCLE_CLIENT_SDK_KEY>` to the SDK Key for your environment.
You can find this under Settings / Environments on the DevCycle dashboard.
* Create a new feature on the dashboard. Update the `variableKey` in `pages/index.tsx` to this value.
* If you added user targeting to your feature, update the `user_id` field in `pages/_app.tsx` based on your targeting rules.

You can now start the app by running:
```sh
yarn nx serve example-nextjs-pages-router
```
Open [http://localhost:4200](http://localhost:4200) to view it in the browser.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do all of our example apps run on port 4200?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea they all do I believe

2 changes: 1 addition & 1 deletion examples/openfeature-nodejs/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"serve": {
"executor": "@nx/js:node",
"options": {
"buildTarget": "self:build"
"buildTarget": "build"
},
"dependsOn": ["^build"]
},
Expand Down
2 changes: 1 addition & 1 deletion examples/openfeature-web/src/app/app.element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ export class AppElement extends HTMLElement {

connectedCallback(): void {
this.updateInnerHTML()
devcycleProvider.DevcycleClient?.subscribe('configUpdated', () => {
devcycleProvider.devcycleClient?.subscribe('configUpdated', () => {
this.updateInnerHTML()
})
}
Expand Down
Loading