node-rsc

0.0.5 • Public • Published

RSC - Really Simple Content RSCR - Really Simple Content Routing

VISIONS

  • Really simple content is distributed thru a routing as embedable HTML
** ex.  rsc__get("afelia.logo") =>  "/img/ico/afelia.png"
** ex.  rsc__getLogo("afelia","html") =>  <img src=/img/ico/afelia.png class="rsc_logo afelia.logo">
** ex.  rsc__getLogo("main","html") =>  <img src=/img/ico/afelia.png class="rsc_logo afelia.logo">
** ex.  rsc__getLogo ("afelia","html",false) =>  <img src=http://afelia.jgwill.com/img/ico/afelia.png class="rsc_logo afelia.logo">
** ex.  rsc__getLogo ("","html",false) =>  <img src=http://afelia.jgwill.com/img/ico/afelia.png class="rsc_logo afelia.logo">

ACTIONS

** A Prototype

  • A package Fork compatible as base

Reality

//a file ./rsc/default.json 
var rsc = require('node-rsc');
 
 
var cnf = rsc.get("Logos");
 
console.log(cnf.test);
{
    "Logos": {
        "test": "myval"
    }
}

NPM   Build Status   release notes

Introduction

Node-rsc organizes hierarchical rscurations for your app deployments.

It lets you define a set of default parameters, and extend them for different deployment environments (development, qa, staging, production, etc.).

Rscurations are stored in rscuration files within your application, and can be overridden and extended by environment variables, command line parameters, or external sources.

This gives your application a consistent rscuration interface shared among a growing list of npm modules also using node-rsc.

Project Guidelines

  • Simple - Get started fast
  • Powerful - For multi-node enterprise deployment
  • Flexible - Supporting multiple rsc file formats
  • Lightweight - Small file and memory footprint
  • Predictable - Well tested foundation for module and app developers

Quick Start

The following examples are in JSON format, but rscurations can be in other file formats.

Install in your app directory, and edit the default rsc file.

$ npm install rsc
$ mkdir rsc
$ vi rsc/default.json
{
  // Customer module rscs
  "Customer": {
    "dbRsc": {
      "host": "localhost",
      "port": 5984,
      "dbName": "customers"
    },
    "credit": {
      "initialLimit": 100,
      // Set low for development
      "initialDays": 1
    }
  }
}

Edit rsc overrides for production deployment:

 $ vi rsc/production.json
{
  "Customer": {
    "dbRsc": {
      "host": "prod-db-server"
    },
    "credit": {
      "initialDays": 30
    }
  }
}

Use rscs in your code:

var rsc = require('rsc');
//...
var dbRsc = rsc.get('Customer.dbRsc');
db.connect(dbRsc, ...);
 
if (rsc.has('optionalFeature.detail')) {
  var detail = rsc.get('optionalFeature.detail');
  //...
}

rsc.get() will throw an exception for undefined keys to help catch typos and missing values. Use rsc.has() to test if a rscuration value is defined.

Start your app server:

export NODE_ENV=production
$ node my-app.js

Running in this rscuration, the port and dbName elements of dbRsc will come from the default.json file, and the host element will come from the production.json override file.

Articles

Further Information

If you still don't see what you are looking for, here more resources to check:

Contributors

lorenwest markstos elliotttf jfelege leachiM2k josx
enyo arthanzel eheikes diversario th507 Osterjour
nsabovic ScionOfBytes simon-scherzinger axelhzf benkroeger fgheorghe
IvanVergiliev jpwilliams jaylynch jberrisch kgoerlitz bertho-zero
leonardovillela nitzan-shaked robertrossmann roncli superoven wmertens

License

May be freely distributed under the MIT license.

Copyright (c) 2010-2018 Loren West and other contributors

Package Sidebar

Install

npm i node-rsc

Weekly Downloads

3

Version

0.0.5

License

MIT

Unpacked Size

99.8 kB

Total Files

9

Last publish

Collaborators

  • jgi