<commit_before>var express = require('express');
var router = express.Router();
var cors = require('cors');
var Query = require('./modules/queries.js');
var Codes = require('./modules/codes.js');
var multer = require('multer');
var schedule = require('node-schedule');
var child_process = require('child_process');
var bodyParser = require('body-parser');
var fs = require('fs-extra');
var app = express();

var codes = new Codes();
var queryy = new Query(codes);

app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
//  app.use(function (req, res, next) {
//   res.setHeader('Access-Control-Allow-Origin', 'http://10.5.163.13:4200'); 
//   res.setHeader('Access-Control-Allow-Methods', 'POST,GET');
//   res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type,Authorization');
//   res.setHeader('Access-Control-Allow-Credentials', true);
//   next()
// });
 
//app.user(bodyParser.json());
// after the code that uses bodyParser and other cool stuff
var originsWhitelist = [
  'http://localhost:4200',      //this is my front-end url for development
  'http://10.5.163.13:4200'
];
var corsOptions = {
  origin: function(origin, callback){
        var isWhitelisted = originsWhitelist.indexOf(origin) !== -1;
        callback(null, isWhitelisted);
  },
  credentials:true
}
//here is the magic
app.use(cors(corsOptions));


var DIR = './uploads/';

var storage = multer.diskStorage({
  destination: function (req, file, cb) {
    cb(null, './uploads/')
  },
  filename: function (req, file, cb) {
      cb(null, file.originalname+"_"+Date.now());

        var params = {
          title: req.body.title,
          description: req.body.description,<commit_msg>backup file code added<commit_after>var express = require('express');
var router = express.Router();
var cors = require('cors');
var Query = require('./modules/queries.js');
var Codes = require('./modules/codes.js');
var multer = require('multer');
var schedule = require('node-schedule');
var child_process = require('child_process');
var bodyParser = require('body-parser');
var fs = require('fs-extra');
var app = express();

var codes = new Codes();
var queryy = new Query(codes);

app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
 
//app.user(bodyParser.json());
// after the code that uses bodyParser and other cool stuff
var originsWhitelist = [
  'http://localhost:4200',      //this is my front-end url for development
  'another_url'
];
var corsOptions = {
  origin: function(origin, callback){
        var isWhitelisted = originsWhitelist.indexOf(origin) !== -1;
        callback(null, isWhitelisted);
  },
  credentials:true
}
//here is the magic
app.use(cors(corsOptions));


var DIR = './uploads/';

var storage = multer.diskStorage({
  destination: function (req, file, cb) {
    cb(null, './uploads/')
  },
  filename: function (req, file, cb) {
      cb(null, file.originalname+"_"+Date.now());

        var params = {
          title: req.body.title,
          description: req.body.description,
{'fraction_non_alphanumeric': 0.17146596858638743, 'fraction_numerical': 0.01112565445026178, 'mean_word_length': 3.9466019417475726, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '6967667', 'n_tokens_mistral': 976, 'n_tokens_neox': 950, 'n_words': 235}