Skip to content

Logging based on IBM Cloud App Configuration Feature Flag

Notifications You must be signed in to change notification settings

jojustin/shoppers-delight

Repository files navigation

Node.js Sample Application for IBM Cloud App Configuration service

DISCLAIMER: This is a guideline sample application and is used for demonstrative and illustrative purposes only. This is not a production ready code.

This sample contains an Node.js microservice that you can use to learn more about the IBM Cloud App Configuration service.

Contents

Prerequisite

  • You need an IBM Cloud account. If you don't have an account, create one here.

Create an instance of App Configuration service

  • Log in to your IBM Cloud account.
  • In the IBM Cloud catalog, search App Configuration and click App Configuration. The service provisioning page opens.
  • Select a region - Currently, Dallas (us-south), London (eu-gb) and Sydney (au-syd) regions are supported.
  • Select a pricing plan, resource group and configure your resource with a service name, or use the preset name.
  • Click Create. A new service instance is created and the App Configuration dashboard is displayed.

Setup the app

Prerequisites

  • Node.js installed on your machine.
  • jq - command-line JSON processor. Install it from here.

Setup the App Configuration service instance

  • Download the source code
    $ git clone https://github.com/saikumar1607/shopping-website.git
    $ cd shopping-website
    
  • Install jq - command-line JSON processor.
    • You can install it from here
  • Go to dashboard of your App Configuration instance in IBM Cloud UI.
  • Navigate to Service Credentials section and generate a new set of credentials. Note down the region, guid and apikey. These credentials are required in the next steps.
  • From your terminal, inside the source code execute the demo.sh script by running below command
    $ ./demo.sh

    If you face any permission errors during the script execution, provide appropriate permission to the file by running - sudo chmod +x ./demo.sh. And then execute the script.

  • Provide all the inputs during script execution. A sample example is shown in below figure
  • Script execution takes time. Script is executed successfully only when you see the log ---Demo script complete--- at the end in your terminal.
  • This script will create the collections, feature flags, properties & segments using the default dev environment in the instance which are required for this sample app.

Run the sample

  • Prerequisites
    • Node.js installed on your machine.
  • Edit the configuration values in file server.js
    • Provide all the configuration values in .env file
  • Installing Dependencies
    • Run npm install from the root folder to install the app’s dependencies.
  • Run npm start to start the app
  • Access the running app in a browser at http://localhost:3000

Use cases

  • Bluetooth earphones
  • Flashsale Banner
  • Exclusive offers section

License

Copyright 2021 IBM Corp.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

See here for detailed docs on App Configuration service.

About

Logging based on IBM Cloud App Configuration Feature Flag

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published