<commit_before>'use strict';

var path = require('path');

var defaultHandler = require('./handlers/default'),
    unicornHandler = require('./handlers/unicorn'),
    mockedHandler = require('./handlers/mocked'),
    statusCodeHandler = require('./handlers/statusCode'),
    homePageService = require('./services/homePageService');

var routes = [
    // Homepage uses github apis to render the README as html
    {
        method: 'GET',
        path: '/',
        handler: function (req, reply) {
            homePageService.getHomePage(function(error, result){
                if(error){
                   return reply.file(path.resolve('README.md'));
                }
                // Quick and dirty
                return reply(
                    '<!DOCTYPE html>' +
                    '<html lang="en">' +
                        '<head>' +
                            '<title>Unicorn API</title>' +
                            '<link rel="stylesheet" href="/css/github-markdown.css"/>' +
                        '</head>' +
                        '<body>' +
                            result +
                        '</body>' +
                    '</html>'
                );
            });
        }
    },

    // Unicorns
    {method: 'GET',     path: '/api/unicorns',                      config: unicornHandler.get},
    {method: 'GET',     path: '/api/unicorns/{id}',                 config: unicornHandler.getOne},
    {method: 'POST',    path: '/api/unicorns',                      config: unicornHandler.post},
    {method: 'PUT',     path: '/api/unicorns/{id}',                 config: unicornHandler.put},
    {method: 'DELETE',  path: '/api/unicorns/{id}',                 config: unicornHandler.delete},
    {method: 'PATCH',   path: '/api/unicorns/{id}',                 config: unicornHandler.patch},
<commit_msg>Last try at using process.env.NODE_ENV in the codeship --> heroku process.<commit_after>'use strict';

var path = require('path');

var defaultHandler = require('./handlers/default'),
    unicornHandler = require('./handlers/unicorn'),
    mockedHandler = require('./handlers/mocked'),
    statusCodeHandler = require('./handlers/statusCode'),
    homePageService = require('./services/homePageService');

var routes = [
    // Homepage uses github apis to render the README as html
    {
        method: 'GET',
        path: '/',
        handler: function (req, reply) {
            homePageService.getHomePage(function(error, result){
                if(error){
                   return reply.file(path.resolve('README.md'));
                }
                // Quick and dirty
                return reply(
                    '<!DOCTYPE html>' +
                    '<html lang="en">' +
                        '<head>' +
                            '<title>Unicorn API</title>' +
                            '<meta environment="' + process.env.NODE_ENV + '"/>' +
                            '<link rel="stylesheet" href="/css/github-markdown.css"/>' +
                        '</head>' +
                        '<body>' +
                            result +
                        '</body>' +
                    '</html>'
                );
            });
        }
    },

    // Unicorns
    {method: 'GET',     path: '/api/unicorns',                      config: unicornHandler.get},
    {method: 'GET',     path: '/api/unicorns/{id}',                 config: unicornHandler.getOne},
    {method: 'POST',    path: '/api/unicorns',                      config: unicornHandler.post},
    {method: 'PUT',     path: '/api/unicorns/{id}',                 config: unicornHandler.put},
    {method: 'DELETE',  path: '/api/unicorns/{id}',                 config: unicornHandler.delete},
    {method: 'PATCH',   path: '/api/unicorns/{id}',                 config: unicornHandler.patch},

{'fraction_non_alphanumeric': 0.14966163456533055, 'fraction_numerical': 0.0, 'mean_word_length': 1.4384517766497462, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7170042', 'n_tokens_mistral': 1032, 'n_tokens_neox': 997, 'n_words': 206}