Skip to main content

Config Example

An example of a simple config pattern.

  1. Create a file named config.js with the following code.
// config.js

let config = {};

// general config
config.appName = "Some App Name";

// github config
config.github = {};
config.github.username = "tingiris";

module.exports = config;
  1. Create a file named app.js that uses config.js with the following code.
const config = require('./config.js');

console.log(`My GitHub username is: ${config.github.username}. The app name is: ${config.appName}.`)