<commit_before>"use strict";

const path = require('path');
const fs = require('fs');

const express = require('express');
const app = express();

const bodyParser = require('body-parser');

const mongoose = require('mongoose');

const articleController = require('./db/articleController');
const contributorController = require('./db/contributorController');

let db;

mongoose.connect(JSON.parse(fs.readFileSync(__dirname + '/db/config.json', 'utf8')).uri, function() {
	db = mongoose.connection;
	db.on('open', () => {console.log('Connected to MongoDB');});
	db.on('error', (err) => {console.error("Database Error: ", err);});
});

app.use(express.static('./client/static_pages'));

app.use(bodyParser());

app.get('/bundle.js', (req, res) => {
	
	console.log("Got a request!", Date.now());
	
	fs.readFile('./build/bundle.js', (err, data) => {
		if(err) {
			res.status('504');
			res.send();
			return console.error(err);
		}
		res.status('200');
		res.set('Content-Type', 'text/javascript');
		res.send(data);
	});

});

app.get('/articles', (req, res) => {
	articleController.getTopArticles(req, res);
});

app.post'/articles', (req, res) => {
	articleController.saveArticle(req, res);
});

app.listen(8080);<commit_msg>Fixed syntax error with PUT<commit_after>"use strict";

const path = require('path');
const fs = require('fs');

const express = require('express');
const app = express();

const bodyParser = require('body-parser');

const mongoose = require('mongoose');

const articleController = require('./db/articleController');
const contributorController = require('./db/contributorController');

let db;

mongoose.connect(JSON.parse(fs.readFileSync(__dirname + '/db/config.json', 'utf8')).uri, function() {
	db = mongoose.connection;
	db.on('open', () => {console.log('Connected to MongoDB');});
	db.on('error', (err) => {console.error("Database Error: ", err);});
});

app.use(express.static('./client/static_pages'));

app.use(bodyParser());

app.get('/bundle.js', (req, res) => {
	
	console.log("Got a request!", Date.now());
	
	fs.readFile('./build/bundle.js', (err, data) => {
		if(err) {
			res.status('504');
			res.send();
			return console.error(err);
		}
		res.status('200');
		res.set('Content-Type', 'text/javascript');
		res.send(data);
	});

});

app.get('/articles', (req, res) => {
	articleController.getTopArticles(req, res);
});

app.put('/articles', (req, res) => {
	articleController.saveArticle(req, res);
});

app.listen(8080);
{'fraction_non_alphanumeric': 0.22181670721816707, 'fraction_numerical': 0.008921330089213302, 'mean_word_length': 5.121588089330025, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '5784520', 'n_tokens_mistral': 871, 'n_tokens_neox': 823, 'n_words': 153}