<commit_before>'use strict';

// const morgan = require('morgan');
const express = require('express');
const mongoose = require('mongoose');
const Promise = require('bluebird');
const createError = require('http-errors');
// const cors = require('cors');
const debug = require('debug')('home:server');

const handleError = require('./lib/error-handler');
const authRouter = require('./routes/auth-router');
const commentRouter = require('./routes/comment-router');

const app = express();
const port = process.env.PORT || 3000;
const mongoDbUri = process.env.MONGODB_URI || 'mongodb://localhost/home';
process.env.APP_SECRET = 'secret';

mongoose.Promise = Promise;
mongoose.connect(mongoDbUri);

// app.use(morgan('dev'));
// app.use(cors());

app.use('/api', authRouter);
app.use('/api/comments', commentRouter);

app.all('*', function(req, res, next){
  debug('Got error: 404');
  next(createError(404, `ERROR: ${req.method} :: ${req.url} is not a route`));
});

app.use(handleError);

app.use(express.static(`${__dirname}/build`));

app.listen(port, function(){
  console.log(`Server up on ${port}`);
  debug(`server up :: ${port}`);
});<commit_msg>debugging<commit_after>'use strict';

// const morgan = require('morgan');
const express = require('express');
const mongoose = require('mongoose');
const Promise = require('bluebird');
const createError = require('http-errors');
// const cors = require('cors');
const debug = require('debug')('home:server');

const handleError = require('./lib/error-handler');
const authRouter = require('./routes/auth-router');
const commentRouter = require('./routes/comment-router');

const app = express();
const port = process.env.PORT || 3000;
const mongoDbUri = process.env.MONGODB_URI || 'mongodb://localhost/home';
process.env.APP_SECRET = 'secret';

mongoose.Promise = Promise;
mongoose.connect(mongoDbUri);

// app.use(morgan('dev'));
// app.use(cors());

app.use('/api', authRouter);
app.use('/api/comments', commentRouter);

// app.all('*', function(req, res, next){
  // debug('Got error: 404');
  // next(createError(404, `ERROR: ${req.method} :: ${req.url} is not a route`));
// });

app.use(handleError);

app.use(express.static(`${__dirname}/build`));

app.listen(port, function(){
  console.log(`Server up on ${port}`);
  debug(`server up :: ${port}`);
});
{'fraction_non_alphanumeric': 0.212618841832325, 'fraction_numerical': 0.00864304235090752, 'mean_word_length': 5.558073654390935, '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': '63017', 'n_tokens_mistral': 760, 'n_tokens_neox': 753, 'n_words': 160}