<commit_before>var mongoose = require('mongoose');
var fs = require('fs');

// connect
mongoose.connect('mongodb://localhost/website', function(err) {
  if (err) { throw err; }
});

// Schema
var fileSchema = new mongoose.Schema({
    id : { type : String},
    content : String
});

// model
var fileModel = mongoose.model('files', fileSchema);

// create the file
exports.createFile = function(nameFile) {
    var newFile = new fileModel({ id : nameFile });
    
    fs.readFile(__dirname + '/../views/markdown_template.ejs', function(err, data) {
        if (err) {
            throw err;
        }
        newFile.content = data;    
        newFile.save(function (err) {
            if (err) { 
                throw err; 
            }
            console.log('We successfully created ' + nameFile + " document.");
        });
    });
}

exports.getFile = function(nameFile, callback) {
    fileModel.find({id: nameFile}, function (err, file) {
        if (err) {
            throw err;
        }
        if (file.length == 0) {
            callback(null);
        } else {
            callback(file[0].content);
        }
    });
}<commit_msg>changed the name of the markdown templae<commit_after>var mongoose = require('mongoose');
var fs = require('fs');

// connect
mongoose.connect('mongodb://localhost/website', function(err) {
  if (err) { throw err; }
});

// Schema
var fileSchema = new mongoose.Schema({
    id : { type : String},
    content : String
});

// model
var fileModel = mongoose.model('files', fileSchema);

// create the file
exports.createFile = function(nameFile) {
    var newFile = new fileModel({ id : nameFile });
    
    fs.readFile(__dirname + '/../views/template/markdown_template.ejs', function(err, data) {
        if (err) {
            throw err;
        }
        newFile.content = data;    
        newFile.save(function (err) {
            if (err) { 
                throw err; 
            }
            console.log('We successfully created ' + nameFile + " document.");
        });
    });
}

exports.getFile = function(nameFile, callback) {
    fileModel.find({id: nameFile}, function (err, file) {
        if (err) {
            throw err;
        }
        if (file.length == 0) {
            callback(null);
        } else {
            callback(file[0].content);
        }
    });
}
{'fraction_non_alphanumeric': 0.1468321917808219, 'fraction_numerical': 0.0017123287671232876, 'mean_word_length': 2.02720207253886, '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': '1618712', 'n_tokens_mistral': 701, 'n_tokens_neox': 696, 'n_words': 162}