<commit_before>var express = require('express');
var request = require('request');
var cheerio = require('cheerio');
var app = express();
var global_base_url = "https://web.spaggiari.eu/home/app/default/";
var base_url = "https://web.spaggiari.eu/cvv/app/default/";


/**
 * Funzioni 
 */
app.get('/:sessionId/profile', function (req, res) {
	profile = new Object();
	check = true;
	url = null;
	
	// # nome alunno e nome scuola
	url = global_base_url + "menu_webinfoschool_genitori.php";
	request({url: url, /*jar: jar*/ headers: {'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:37.0) Gecko/20100101 Firefox/37.0',
	            'Set-Cookie': "PHPSESSID=" + req.params.sessionId,
	            'Cookie': "PHPSESSID=" + req.params.sessionId}
	}, function(error, response, body) {
		$ = cheerio.load(body);
		if ($('.name').length) {
			// profile['status'] = "OK";
			profile['name'] = $('.name').text();
			profile['school'] = $('.scuola').text();
			// res.send(JSON.stringify(result));
		} else {
			check = false;
			// res.send('{"status":"error"}');
		}
	});
	<commit_msg>Aggiunto modulo 'cors' per abilitare richieste multi-origine<commit_after>var express = require('express');
var cors = require('cors');
var request = require('request');
var cheerio = require('cheerio');
var global_base_url = "https://web.spaggiari.eu/home/app/default/";
var base_url = "https://web.spaggiari.eu/cvv/app/default/";

var app = express();
// abilita richieste multi-origine
app.use(cors());


/**
 * Funzioni 
 */
app.get('/:sessionId/profile', function (req, res) {
	profile = new Object();
	check = true;
	url = null;
	
	// # nome alunno e nome scuola
	url = global_base_url + "menu_webinfoschool_genitori.php";
	request({url: url, /*jar: jar*/ headers: {'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:37.0) Gecko/20100101 Firefox/37.0',
	            'Set-Cookie': "PHPSESSID=" + req.params.sessionId,
	            'Cookie': "PHPSESSID=" + req.params.sessionId}
	}, function(error, response, body) {
		$ = cheerio.load(body);
		if ($('.name').length) {
			// profile['status'] = "OK";
			profile['name'] = $('.name').text();
			profile['school'] = $('.scuola').text();
			// res.send(JSON.stringify(result));
		} else {
			check = false;
			// res.send('{"status":"error"}');
		}
	});
	
{'fraction_non_alphanumeric': 0.20956521739130435, 'fraction_numerical': 0.019130434782608695, 'mean_word_length': 3.734567901234568, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '554482', 'n_tokens_mistral': 904, 'n_tokens_neox': 828, 'n_words': 163}