<commit_before>var express = require('express');
var app = express();
// Using needle because 'request' doesn't allow raw form data.
var needle = require('needle');
var bodyParser = require('body-parser');
// Using request because needle doesn't follow redirects.
var request = require('request');

app.set('port', (process.env.PORT || 3000));

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

app.get('/links', function (req, res) {
  res.json({ message: 'message from links!' });
});

app.post('/links', function (req, res) {

  console.log('---------\ngot a post request');

  console.log(req.body);
  console.log('stringify:');
  var stringified = JSON.stringify(req.body).replace("%", "");
  console.log(stringified);

  needle.post(
    'http://search.crossref.org/links',
    stringified,
    {},
    function(err, resp) {
      console.log('returned from links');

      if (resp && resp.body &&
        resp.body.results && resp.body.results.length > 0 &&<commit_msg>Using https instead of http<commit_after>var express = require('express');
var app = express();
// Using needle because 'request' doesn't allow raw form data.
var needle = require('needle');
var bodyParser = require('body-parser');
// Using request because needle doesn't follow redirects.
var request = require('request');

app.set('port', (process.env.PORT || 3000));

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

app.get('/links', function (req, res) {
  res.json({ message: 'message from links!' });
});

app.post('/links', function (req, res) {

  console.log('---------\ngot a post request');

  console.log(req.body);
  console.log('stringify:');
  var stringified = JSON.stringify(req.body).replace("%", "");
  console.log(stringified);

  needle.post(
    'https://search.crossref.org/links',
    stringified,
    {},
    function(err, resp) {
      console.log('returned from links');

      if (resp && resp.body &&
        resp.body.results && resp.body.results.length > 0 &&
{'fraction_non_alphanumeric': 0.19228843264897347, 'fraction_numerical': 0.005007511266900351, 'mean_word_length': 3.909090909090909, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 1, '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': '2386401', 'n_tokens_mistral': 621, 'n_tokens_neox': 602, 'n_words': 150}