<commit_before>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

var fs = require('fs');

var verify = require('../lib/verify');
var urls = require('../lib/urls');

module.exports = function (store, viewsPath, urlManager, remixMailer, makeAPIPublisher) {
  var mongoose = require('mongoose');
  var dbconn = mongoose.connect(process.env.MONGOLAB_URI || 'mongodb://localhost/componentregistry');

  return {
    index: function(req, res) {
      res.render('index.ejs');
    },

    designer: function (req, res) {
      var publishUrl = urlManager.createURLPrefix('{remixName}');
      if (req.method === 'POST' && req.body && req.body.data) {
        verify.filter(req.body.data, function (htmlInjection) {
          res.render('designer', {
            htmlInjection: htmlInjection,
            publishUrl: publishUrl
          });
        });
      }
      else {
        res.render('designer', {
          htmlInjection: '',
          publishUrl: publishUrl
        });
      }<commit_msg>use more generic name for mongo db<commit_after>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

var fs = require('fs');

var verify = require('../lib/verify');
var urls = require('../lib/urls');

module.exports = function (store, viewsPath, urlManager, remixMailer, makeAPIPublisher) {
  var mongoose = require('mongoose');
  var dbconn = mongoose.connect(process.env.MONGOLAB_URI || 'mongodb://localhost/appmakerdev');

  return {
    index: function(req, res) {
      res.render('index.ejs');
    },

    designer: function (req, res) {
      var publishUrl = urlManager.createURLPrefix('{remixName}');
      if (req.method === 'POST' && req.body && req.body.data) {
        verify.filter(req.body.data, function (htmlInjection) {
          res.render('designer', {
            htmlInjection: htmlInjection,
            publishUrl: publishUrl
          });
        });
      }
      else {
        res.render('designer', {
          htmlInjection: '',
          publishUrl: publishUrl
        });
      }
{'fraction_non_alphanumeric': 0.14180717682663208, 'fraction_numerical': 0.0034587116299178555, 'mean_word_length': 2.6440944881889763, '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': '2830343', 'n_tokens_mistral': 703, 'n_tokens_neox': 697, 'n_words': 182}