read-appsettings-json
TypeScript icon, indicating that this package has built-in type declarations

1.0.98 • Public • Published

read-appsettings-json | Simple and easy read appsettings.json file

read-appsettings-json is an easy way to read a local app settings file in a json format.

read-appsettings-json

npm version Build Status npm GitHub issues npm

Getting Started

  1. install read-appsettings-json through npm package using the following command:

     `npm install read-appsettings-json --save`
    
  2. You need to create a appsettings.json file in the root of your project. Let's create the following appsettings.json

{
    "apiendpoint": "http://localhost:3035",
    "second":2,
    "booleanflag":true
}

Now, this like is in a default root as ../../../appsettings.json which can be found at \node_modules\read-appsettings-json\dist\index.js once you install the package. To access to you property just type its name as shown in the examples below. Important to remember that you can create different settings as need it.

  1. use it as following
// Service Class    
import { AppConfiguration } from "read-appsettings-json";
 
 console.log(AppConfiguration.Setting().apiendpoint);

ANOTHER Example

{
    "day": 1,
    "year":2017,
    "month":12
}

TYPESCRIPT WOULD BE

// Service Class    
import { AppConfiguration } from "read-appsettings-json";
 
console.log(AppConfiguration.Setting().month)

Don't forget to add this code on your tsconfig.json, otherwise appsettings.json will be included into the bundle, defeating the purpose of this library, NO GOOD.

{
  // Your code
  "exclude": [
    "**/appsettings.json",
    "**/appsettings.Development.json"
  ]
}

Please take a look to the demo

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.98229latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.98229
1.0.950
1.0.940
1.0.930
1.0.920
1.0.910
1.0.900
1.0.500
1.0.350
1.0.310
1.0.300
1.0.290
1.0.270
1.0.250
1.0.200
1.0.100
1.0.90
1.0.80
1.0.70
1.0.60
1.0.50
1.0.327
1.0.20
1.0.10
1.0.00
1.0.0-beta.70
1.0.0-beta.60
1.0.0-beta.50
1.0.0-beta.40
1.0.0-beta.30
1.0.0-beta.20
1.0.0-beta.10

Package Sidebar

Install

npm i read-appsettings-json

Weekly Downloads

256

Version

1.0.98

License

MIT

Unpacked Size

6.36 kB

Total Files

7

Last publish

Collaborators

  • codechavez