Esempio n. 1
0
app.get('/', function (req, res) {
  res.render('index', {
    env: env('FH_ENV', 'local')
  });
});
Esempio n. 2
0
'use strict';

var _ = require('lodash')
  , env = require('get-env')
  , caseify = require('case')
  , Validator = require('jsonschema').Validator
  , traceSchema = require('lib/schema/trace')
  , mongo = require('mongo-utils')
  , defUrl = 'mongodb://127.0.0.1:27017/tracing';

var mgr = mongo.getDatabaseManager({
  mongoUrl: env('FH_MONGODB_CONN_URL', defUrl)
});


/**
 * Determines if the provided trace is valid
 * @param  {Object}  trace
 * @return {Object}
 */
exports.verifyTrace = function (trace) {
  return new Validator().validate(trace, traceSchema);
};


/**
 * Clones the input Object and returns it with header names
 * converted to camel case format
 * @param  {Object} data
 * @return {Object}
 */
Esempio n. 3
0
'use strict';

var express = require('express')
  , fhlog = require('fhlog')
  , env = require('get-env')
  , app = module.exports = express()
  , log = fhlog.get('')
  , path = require('path')
  , mbaasApi = require('fh-mbaas-api')
  , mbaasExpress = mbaasApi.mbaasExpress()
  , port = env('FH_PORT') || env('OPENSHIFT_NODEJS_PORT', 3001)
  , host = env('OPENSHIFT_NODEJS_IP', '0.0.0.0');

// Logging defaults to only write info level logs, can be overwritten by env var
fhlog.setDefault(
  'level',
  fhlog.LEVELS[
    env('TRACING_LOG_LEVEL', 'INF')
  ]
);

log.i('starting application');

// Bind routes to our application
require('lib/routes/trace')(app);
require('lib/routes/js')(app);

app.use('/sys', mbaasExpress.sys([]));
app.use('/mbaas', mbaasExpress.mbaas);

app.set('view engine', 'jade');