Skip to content

jojustin/nconf-appconfig-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node.js Sample Application for nconf-appconfig npm

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

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.
  • 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 and properties 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

See here for detailed docs on App Configuration service.

About

Use nconf-appconfig to load properties from IBM Cloud App Configuration Service

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors