<commit_before>require('dotenv').load();

var express = require('express');
var favicon = require('serve-favicon');
var morgan = require('morgan');
var logger = require('./lib/logger');
var bodyParser = require('body-parser');

var slash = require('./routes/slash');
var auth = require('./routes/auth');

require('./adapters/_init');
var SlackTime = require('./lib/slack_time');

if (!process.env.SLACK_CLIENT_ID || !process.env.SLACK_CLIENT_SECRET || !process.env.SLACK_SLASH_TOKEN) {
  logger.error('Error: Specify SLACK_CLIENT_ID SLACK_CLIENT_SECRET SLACK_SLASH_TOKEN in environment');
  process.exit(1);
}

var app = express();

app.use(morgan('combined', { 'stream': logger.stream }));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));

app.use('/slack/receive', slash({
  handler: SlackTime,
  token: process.env.SLACK_SLASH_TOKEN
}));
app.use('/slack', auth({
  clientId: process.env.SLACK_CLIENT_ID,
  clientSecret: process.env.SLACK_CLIENT_SECRET,
  scopes: SlackTime.requiredOAuthScopes
}));

// catch 404 and forward to error handler
app.use(function(req, res, next) {
  res.status(404).send("Not Found");
});

// error handlers

app.use(function(err, req, res, next) {
  logger.error("Error: " + err + "\n" + err.stack);
  res.status(err.status || 500).send("Channel Time crashed :boom:");
});

module.exports = app;<commit_msg>Serve static site<commit_after>require('dotenv').load();

var express = require('express');
var morgan = require('morgan');
var logger = require('./lib/logger');
var bodyParser = require('body-parser');

var slash = require('./routes/slash');
var auth = require('./routes/auth');

require('./adapters/_init');
var SlackTime = require('./lib/slack_time');

if (!process.env.SLACK_CLIENT_ID || !process.env.SLACK_CLIENT_SECRET || !process.env.SLACK_SLASH_TOKEN) {
  logger.error('Error: Specify SLACK_CLIENT_ID SLACK_CLIENT_SECRET SLACK_SLASH_TOKEN in environment');
  process.exit(1);
}

var app = express();

app.use(morgan('combined', { 'stream': logger.stream }));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));

app.use('/slack/receive', slash({
  handler: SlackTime,
  token: process.env.SLACK_SLASH_TOKEN
}));
app.use('/slack', auth({
  clientId: process.env.SLACK_CLIENT_ID,
  clientSecret: process.env.SLACK_CLIENT_SECRET,
  scopes: SlackTime.requiredOAuthScopes
}));

app.use(express.static('web/build'));

// catch 404 and forward to error handler
app.use(function(req, res, next) {
  res.status(404).send("Not Found");
});

// error handlers

app.use(function(err, req, res, next) {
  logger.error("Error: " + err + "\n" + err.stack);
  res.status(err.status || 500).send("Channel Time crashed :boom:");
});

module.exports = app;
{'fraction_non_alphanumeric': 0.18324225865209473, 'fraction_numerical': 0.007285974499089253, 'mean_word_length': 5.491725768321513, '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': '5534311', 'n_tokens_mistral': 961, 'n_tokens_neox': 958, 'n_words': 181}