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.
- Prerequisite
- Create an instance of App Configuration service
- Setup the app
- Run the app locally
- Test the app with feature toggle and segmentation
- License
- 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.
- Node.js installed on your machine.
- jq - command-line JSON processor. Install it from here.
- 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
andapikey
. 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.
- 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
- Run
npm start
to start the app - Access the running app in a browser at http://localhost:3000
- Bluetooth earphones
- Flashsale Banner
- Exclusive offers section
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.