text: 'use strict';
  
  var express = require('express');
  var kraken = require('kraken-js');
  var http = require('http');
  var dbConnect = require('./lib/database');
  
  var options, app;
  var server;
  
  /*
   * Create and configure application. Also exports application instance for use by tests.
   * See https://github.com/krakenjs/kraken-js#options for additional configuration options.
   */
  options = {
      onconfig: function (config, next) {
          /*
           * Add any additional config setup or overrides here. `config` is an initialized
           * `confit` (https://github.com/krakenjs/confit/) configuration object.
           */
          next(null, config);
      }
  };
  
  app = module.exports = express();
  app.use(kraken(options));
  app.use(function(req, res, next) {
    res.header("Access-Control-Allow-Origin", "*");
    res.header("Access-Control-Allow-Headers", "X-Requested-With");
    res.header("Access-Control-Allow-Headers:my-header", "accept, content-type, token");
    next();
   });
  
  app.on('start', function () {
      console.log('Application ready to serve requests.');
      console.log('Environment: %s', app.kraken.get('env:env'));
      dbConnect.configure();
  });
  
  
  
  server = http.createServer(app);
  server.listen(process.env.PORT || 8000);
  server.on('listening', function () {
      console.log('Server listening on http://localhost:%d', this.address().port);
  });
  