<commit_before>﻿var express = require('express'),
    stylus = require('stylus'),
    bodyParser = require('body-parser'),
    mongoose = require('mongoose');

var env = process.env.NODE_ENV || 'development';
var port = 3030;

var app = express();

app.set('view engine', 'jade');
app.set('views', __dirname + '/server/views/');

app.use(bodyParser());
app.use(stylus.middleware({
    src: __dirname + '/public',
    compile: function(str, path) {
        return stylus(str).set('filename', path);
    }
}));
app.use(express.static(__dirname + '/public'));

mongoose.connect('mongodb://localhost/novCraftDb');
var db = mongoose.connection;

db.once('open', function(err) {
    if(err) {
        console.log('Database could not be opened' + err);
        return;
    }

    console.log('Database up and running');
});

db.on('error', function(err) {
    console.log('Database error ' + err);
});

var messageSchema = mongoose.Schema({
    message: String
});

var Message = mongoose.model('Message', messageSchema);
// test
var messageFromDatabase;

Message.remove({}).exec(function(err) {
    if (err) {
        console.log('Messages could not be cleared' + err);
        return;
    }

    // adds the message after everything is deleted
    Message.create({ message: 'Hi from Mongoose' })
        .then(function(model) {
            messageFromDatabase = model.message;
        });
});

app.get('/partials/:partialName', function(req, res) {
    res.render('partials/' + req.params.partialName);
});

app.get('*', function(req, res) {
    res.render('index', {message: messageFromDatabase});<commit_msg>testing webstorm commits<commit_after>﻿var express = require('express'),
    stylus = require('stylus'),
    bodyParser = require('body-parser'),
    mongoose = require('mongoose');

var env = process.env.NODE_ENV || 'development';
var port = 3030;

var app = express();

app.set('view engine', 'jade');
app.set('views', __dirname + '/server/views/');

app.use(bodyParser());
app.use(stylus.middleware({
    src: __dirname + '/public',
    compile: function(str, path) {
        return stylus(str).set('filename', path);
    }
}));
app.use(express.static(__dirname + '/public'));

mongoose.connect('mongodb://localhost/novCraftDb');
var db = mongoose.connection;

db.once('open', function(err) {
    if(err) {
        console.log('Database could not be opened' + err);
        return;
    }

    console.log('Database up and running');
});

db.on('error', function(err) {
    console.log('Database error ' + err);
});

var messageSchema = mongoose.Schema({
    message: String
});

var Message = mongoose.model('Message', messageSchema);
// tests
var messageFromDatabase;

Message.remove({}).exec(function(err) {
    if (err) {
        console.log('Messages could not be cleared' + err);
        return;
    }

    // adds the message after everything is deleted
    Message.create({ message: 'Hi from Mongoose' })
        .then(function(model) {
            messageFromDatabase = model.message;
        });
});

app.get('/partials/:partialName', function(req, res) {
    res.render('partials/' + req.params.partialName);
});

app.get('*', function(req, res) {
    res.render('index', {message: messageFromDatabase});
{'fraction_non_alphanumeric': 0.1750465549348231, 'fraction_numerical': 0.002482929857231533, 'mean_word_length': 3.624103299856528, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2669113', 'n_tokens_mistral': 1011, 'n_tokens_neox': 1007, 'n_words': 219}