<commit_before>/**
 * default service pack
 */

'use strict';
const marked = require('marked');
const fs = require('fs');

APP.get('/', function (req, res) {
  let file = _PATH_ROOT + 'README.md';
  let opts = {
    renderer: new marked.Renderer(),
    gfm: true,
    tables: true,
    breaks: false,
    pedantic: false,
    sanitize: true,
    smartLists: true,
    smartypants: false
  };
  marked.setOptions(opts);
  let src = marked(fs.readFileSync(file).toString()).replace(/<table>/g, '<table class="table">');
  res.send(`
  <html>
  <head>
    <title>Node Micro Service Bootstrap</title>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
    rel="stylesheet"
    crossorigin="anonymous">
    <style>
    h1, h2, h3, h4, h5{
    margin-top: 20px;
    }
    </style>
  </head>
  <body>
  <div class="container" style="margin-bottom: 60px;line-height: 1.8;">
    <div class="row">
    <div class="alert alert-info" role="alert"><strong>You are seeing this page because the default service is loaded,
    run the app with custom services and the default service will be replaced.</strong></div>
    ${src}
    </div>
  </div>
  </body>
  </html>
  `);
});

/**
 * example apis
 */
APP.get('/example/:action', function (req, res) {
  const example = _LIB.example;
  const action = req.params.action;
  let response = {};
  // callback and use response maker
  try {
    const callback = _LIB.example[action];
    response = _LIB.util.response.success(callback('hello world'), `action ${action} success`);
  } catch (e) {
    response = _LIB.util.response.error(e);
  }
  // return response
  res.send(response);
});<commit_msg>add debug<commit_after>/**
 * default service pack
 */

'use strict';
const marked = require('marked');
const fs = require('fs');

APP.get('/', function (req, res) {
  let file = _PATH_ROOT + 'README.md';
  let opts = {
    renderer: new marked.Renderer(),
    gfm: true,
    tables: true,
    breaks: false,
    pedantic: false,
    sanitize: true,
    smartLists: true,
    smartypants: false
  };
  marked.setOptions(opts);
  let src = marked(fs.readFileSync(file).toString()).replace(/<table>/g, '<table class="table">');
  res.send(`
  <html>
  <head>
    <title>Node Micro Service Bootstrap</title>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
    rel="stylesheet"
    crossorigin="anonymous">
    <style>
    h1, h2, h3, h4, h5{
    margin-top: 20px;
    }
    </style>
  </head>
  <body>
  <div class="container" style="margin-bottom: 60px;line-height: 1.8;">
    <div class="row">
    <div class="alert alert-info" role="alert"><strong>You are seeing this page because the default service is loaded,
    run the app with custom services and the default service will be replaced.</strong></div>
    ${src}
    </div>
  </div>
  </body>
  </html>
  `);
});

/**
 * example apis
 */
APP.get('/example/:action', function (req, res) {
  const example = _LIB.example;
  const action = req.params.action;
  let response = {};
  // callback and use response maker
  try {
    const callback = _LIB.example[action];
    _log('EXAMPLE', {
      action: action,
      callback: callback,
      params: req.params
    });
    response = _LIB.util.response.success(callback('hello world'), `action ${action} success`);
  } catch (e) {
    _log('EXAMPLE', {
      action: action,
      error: e.toString()
    }, 'ERROR');
    response = _LIB.util.response.error(e);
  }
  // return response
  res.send(response);
});
{'fraction_non_alphanumeric': 0.1683702441794435, 'fraction_numerical': 0.007950028392958546, 'mean_word_length': 3.1791221826809015, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 45, 'https://': 2, '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': '5492921', 'n_tokens_mistral': 1192, 'n_tokens_neox': 1175, 'n_words': 298}