Skip to content
This repository has been archived by the owner on Jul 27, 2021. It is now read-only.
/ appknobs-examples Public archive

Appknobs.io client library implementation examples

Notifications You must be signed in to change notification settings

appknobs/appknobs-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

APPKNOBS EXAMPLES

Appknobs.io client library implementation examples

Requirements

You will need an Appknobs.io app ID, API key and a feature name for these examples to work.

You can register a user, create an app, grab the API key and set up features on https://console.appknobs.io

Read our quickstart guide for Angular or React to get familiar with the basic concepts.

Setup

Add your

  • app ID,
  • API key
  • feature name
  • payload

to config.js:

cp config.sample.js config.js

so it looks something like this:

module.exports = {
  apiKey: 'arbjc9ldLdEoFeXGIh69g',
  appId: 'IDkfh378dfhjJJHDFJ_d7',
  featureName: 'my-test-feature',
  payload: {username: 'yours_truly'},
}

Running examples

Angular

An implementation of @appknobs/angular using Angular 7.

Note: you need to manually set the feature name in angular/src/app/app.component.html to the one you would add in config.js:

<ak-feature name='YOUR_FEATURE_NAME'>
  <span>Very well, the feature is enabled 👏</span>
</ak-feature>

To start the example on http://localhost:4200/ run:

cd angular
npm install
npm start

React client and server (SSR)

This example uses Next.js to demonstrate both client-side and server-side rendering.

cd react-nextjs
yarn
yarn start

React legacy (15+)

cd react-legacy
yarn
yarn start

React Native

Make sure you have set up your environment for either iOS or Android

cd react-native
yarn // or npm install

then

yarn ios

or start an Android emulator and

yarn android

Electron

A minimal implementation using Electron to demonstrate fetching available features in both the main and renderer process, using newElectronClient and newBrowserClient respectively.

cd electron
yarn
yarn start