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

var express = require('express'); // require Express
var lessCSS = require('less-middleware');
var morgan = require('morgan');
var loggly = require('loggly');


var routes = require('./routes/index');
var pizza = require('./routes/pizza');

var app = express(); // executes Express, save as app

// settings
app.set('view engine', 'ejs');  // sets the settings for EJS

app.locals.title = 'aweso.me';

// middlewares
app.use(lessCSS('public'));

var logStream = fs.createWriteStream('access.log', {flags: 'a'});
//output to access.log file in Apache format
app.use(morgan('combined', {stream: logStream}));
//output to console in Dev format
app.use(morgan('dev'));

var client = loggly.createClient({
  token: '<PASSWORD>',
  subdomain: 'BryanDuplantis',
  tags: ['NodeJS'],
  json: true
});

app.use(function(err, req, res, next) {
  client.log({
    ip: req.ip,
    date: new Date(),
    url: req.url,
    status: res.statusCode,
    method: req.method,
    err: err
  });
  next();
});

app.use(express.static('public'));

// routes
app.use('/', routes);
app.use('/pizza', pizza);

// errors
app.use(function (req, res) {
  // 400s before 500s
  res.status(403).send('Unauthorized!');
});

app.use(function (err, req, res, next) {
  // Pass 4 arguments to create an error handling middleware
  console.log('ERRRRRRRRR', err.stack);
  res.status(500).send('My Bad!');
});

var server = app.listen(3000, function () {
  var host = server.address().address;
  var port = server.address().port;

  console.log('Example app listening at http://%s:%s', host, port);
});<commit_msg>added chickennuggets module form<commit_after>var fs = require('fs');

var express = require('express');
var lessCSS = require('less-middleware');
var morgan = require('morgan');

var routes = require('./routes/index');
var pizza = require('./routes/pizza');
var chickennuggets = require('./routes/chickennuggets');


var app = express();

app.set('view engine', 'ejs');
app.set('case sensitive routing', true);

app.locals.title = 'aweso.me';

app.use(lessCSS('public'));

var logStream = fs.createWriteStream('access.log', {flags: 'a'});
app.use(morgan('combined', {stream: logStream}));
app.use(morgan('dev'));

app.use(function (req, res, next) {
  var client = require('./lib/loggly')('incoming');

  client.log({
    ip: req.ip,
    date: new Date(),
    url: req.url,
    status: res.statusCode,
    method: req.method
  });
  next();
});

app.use(express.static('public'));

app.use('/', routes);
app.use('/pizza', pizza);
app.use('/chickennuggets', chickennuggets);

app.use(function (req, res) {
  res.status(403).send('Unauthorized!');
});

app.use(function (err, req, res, next) {
  var client = require('./lib/loggly')('error');

  client.log({
    ip: req.ip,
    date: new Date(),
    url: req.url,
    status: res.statusCode,
    method: req.method,
    stackTrace: err.stack
  });

  // pass 4 arguments to create an error handling middleware
  console.log('ERRRRRRRRRR', err.stack);
  res.status(500).send('My Bad');
});

var server = app.listen(3000, function () {
  var host = server.address().address;
  var port = server.address().port;

  console.log('Example app listening at http://%s:%d', host, port);
});
{'fraction_non_alphanumeric': 0.1951369652200677, 'fraction_numerical': 0.008618036318867343, 'mean_word_length': 4.18341307814992, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '5223612', 'n_tokens_mistral': 1123, 'n_tokens_neox': 1098, 'n_words': 274}