<commit_before>/**
 * Module dependencies.
 */

var express = require('express')
    , fs = require('fs')
    , mongoose = require('mongoose')
    , exec = require('child_process').exec
    , https = require('https');


var app = module.exports = express();

// Configuration

app.configure(function(){
    app.use(express.bodyParser({
        uploadDir: __dirname + '/../app/tmp',
        keepExtensions: true
    }));
    app.use(express.methodOverride());
    app.use(app.router);
    app.use(express.static(__dirname + '/../app'));

    // Copy the schemas to somewhere they can be served
    exec('cp '+__dirname+'/../server/models/* '+__dirname+'/../app/code/',
        function (error, stdout, stderr) {
            if (error !== null) {
                console.log('Error copying models : ' + error + ' (Code = ' + error.code + '    ' + error.signal + ') : ' + stderr + ' : ' + stdout);
            }
        });
});

app.configure('development', function(){
    app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
//    mongoose.connect('mongodb://localhost/forms-ng_dev');
    mongoose.connect('mongodb://theworld:<EMAIL>:10053/formsng');
});

app.configure('production', function(){
    console.log('Production mode');
    app.use(express.errorHandler());
    mongoose.connect('mongodb://theworld:<EMAIL>:10053/formsng');
});


var ensureAuthenticated = function (req, res, next) {
    // Here you can do authentication using things like
    //      req.ip
    //      req.route
    //      req.url
    if (true) { return next(); }
    res.status(401).send('No Authentication Provided');
};

//// Bootstrap models
var DataFormHandler = new (require(__dirname + '/lib/data_form.js'))(app, {urlPrefix : '/api/'});
// Or if you want to do some form of authentication...
// var DataFormHandler = new (require(__dirname + '/lib/data_form.js'))(app, {urlPrefix : '/api/', authentication : ensureAuthenticated});

var models_path = __dirname + '/models';
var models_files = fs.readdirSync(models_path);
models_files.forEach(function(file){
    var fname = models_path+'/'+file;
    if (fs.statSync(fname).isFile()) {
        DataFormHandler.addResource(file.slice(0,-3), require(fname));<commit_msg>Set back to using dev data<commit_after>/**
 * Module dependencies.
 */

var express = require('express')
    , fs = require('fs')
    , mongoose = require('mongoose')
    , exec = require('child_process').exec
    , https = require('https');


var app = module.exports = express();

// Configuration

app.configure(function(){
    app.use(express.bodyParser({
        uploadDir: __dirname + '/../app/tmp',
        keepExtensions: true
    }));
    app.use(express.methodOverride());
    app.use(app.router);
    app.use(express.static(__dirname + '/../app'));

    // Copy the schemas to somewhere they can be served
    exec('cp '+__dirname+'/../server/models/* '+__dirname+'/../app/code/',
        function (error, stdout, stderr) {
            if (error !== null) {
                console.log('Error copying models : ' + error + ' (Code = ' + error.code + '    ' + error.signal + ') : ' + stderr + ' : ' + stdout);
            }
        });
});

app.configure('development', function(){
    app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
    mongoose.connect('mongodb://localhost/forms-ng_dev');
//    mongoose.connect('mongodb://theworld:<EMAIL>:10053/formsng');
//    console.log('************    Using LIVE data  ***************')
});

app.configure('production', function(){
    console.log('Production mode');
    app.use(express.errorHandler());
    mongoose.connect('mongodb://theworld:k12gY<EMAIL>:10053/formsng');
});


var ensureAuthenticated = function (req, res, next) {
    // Here you can do authentication using things like
    //      req.ip
    //      req.route
    //      req.url
    if (true) { return next(); }
    res.status(401).send('No Authentication Provided');
};

//// Bootstrap models
var DataFormHandler = new (require(__dirname + '/lib/data_form.js'))(app, {urlPrefix : '/api/'});
// Or if you want to do some form of authentication...
// var DataFormHandler = new (require(__dirname + '/lib/data_form.js'))(app, {urlPrefix : '/api/', authentication : ensureAuthenticated});

var models_path = __dirname + '/models';
var models_files = fs.readdirSync(models_path);
models_files.forEach(function(file){
    var fname = models_path+'/'+file;
    if (fs.statSync(fname).isFile()) {
        DataFormHandler.addResource(file.slice(0,-3), require(fname));
{'fraction_non_alphanumeric': 0.18378140149845748, 'fraction_numerical': 0.007051564565888057, 'mean_word_length': 3.187269372693727, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '459807', 'n_tokens_mistral': 1402, 'n_tokens_neox': 1374, 'n_words': 288}