<commit_before>"use strict";

require('async-to-gen/register')
const restify = require('restify');

var server = restify.createServer();

server.use(restify.CORS({
    credentials: true
}));


server.use(restify.CORS());

server.post('/-/login', restify.bodyParser(), require('./login'));

server.get('/-/files/:team/:user/:file', require('./serve-file'));
server.get('/-/metadata/:team/:user/:file', require('./metadata'));

server.get('/-/session/:session', require('./session'));

server.get('/-/files.list', require('./list')());

server.post('/-/upload', require('./upload')())
server.opts('/-/upload', (req, res, next) => {
  res.setHeader('Access-Control-Allow-Origin', '*');
  res.setHeader('Access-Control-Allow-Headers', 'Origin, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, Authorization');
res.setHeader('Access-Control-Allow-Methods', '*');
  res.send(200)
  next()
})

server.listen(process.env.PORT || 3001, function() {
  console.log('%s listening at %s', server.name, server.url);
});
<commit_msg>Fix CORS for list response<commit_after>"use strict";

require('async-to-gen/register')
const restify = require('restify');

var server = restify.createServer();

server.use(restify.CORS({
    credentials: true
}));


server.use(restify.CORS());

server.post('/-/login', restify.bodyParser(), require('./login'));

server.get('/-/files/:team/:user/:file', require('./serve-file'));
server.get('/-/metadata/:team/:user/:file', require('./metadata'));

server.get('/-/session/:session', require('./session'));

server.get('/-/files.list', require('./list')());
server.opts('/-/files.list', allowCORS)

server.post('/-/upload', require('./upload')())
server.opts('/-/upload', allowCORS)

function allowCORS(req, res, next) {
  res.setHeader('Access-Control-Allow-Origin', '*');
  res.setHeader('Access-Control-Allow-Headers', 'Origin, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, Authorization');
res.setHeader('Access-Control-Allow-Methods', '*');
  res.send(200)
  next()
}

server.listen(process.env.PORT || 3001, function() {
  console.log('%s listening at %s', server.name, server.url);
});

{'fraction_non_alphanumeric': 0.24040684234858992, 'fraction_numerical': 0.007397133610725843, 'mean_word_length': 5.1477272727272725, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '3881462', 'n_tokens_mistral': 714, 'n_tokens_neox': 698, 'n_words': 112}