bouquins/lib/util/config.js
Meutel 0d0f564475 Project creation
boostrap: start webserver, router catches requests
routeur: create outputter and endpoint, trigger actions
outputter: write in specified format
action: act on resource
2014-01-19 14:37:31 +01:00

23 lines
400 B
JavaScript

/**
* Config module.
* TODO license
*/
var config = exports;
/**
* Loads config from config file
*/
config.loadconfig=function(configfile, callback) {
require('fs').readFile(
configfile, {encoding:'utf8'},
function(err, data) {
if (err) callback(err);
try {
var config = JSON.parse(data);
callback(null, config);
} catch (err) {
callback(err);
}
});
};