{"size": 527, "ext": "js", "max_stars_repo_path": "master/nodejs_learning-master/nodejs_learning-master/request.js", "max_stars_repo_name": "AlexRogalskiy/DevArtifacts", "max_stars_repo_stars_event_min_datetime": "2018-09-07T15:35:24.000Z", "max_stars_repo_stars_event_max_datetime": "2019-03-27T09:48:12.000Z", "max_issues_repo_path": "master/nodejs_learning-master/nodejs_learning-master/request.js", "max_issues_repo_name": "AlexRogalskiy/DevArtifacts", "max_issues_repo_issues_event_min_datetime": "2020-03-04T21:51:56.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T20:59:11.000Z", "max_forks_repo_path": "master/nodejs_learning-master/nodejs_learning-master/request.js", "max_forks_repo_name": "AlexRogalskiy/DevArtifacts", "max_forks_repo_forks_event_min_datetime": "2019-06-18T19:57:17.000Z", "max_forks_repo_forks_event_max_datetime": "2020-11-06T03:55:08.000Z"}
{"max_stars_count": 4, "max_issues_count": 371, "max_forks_count": 3, "avg_line_length": 29.2777777778, "max_line_length": 69, "alphanum_fraction": 0.5901328273}
var url = require('url');
var debug = require('debug')('server:request');

module.exports = function(req, res) {
    //console.log(req.headers);
    debug("Got Request", req.method, req.url);

    var urlParsed = url.parse(req.url, true);  

    if ( urlParsed.pathname == '/echo' && urlParsed.query.message ) {
        debug( "Echo: " + urlParsed.query.message );
        res.end( urlParsed.query.message );
    } else {
        debug("Unkwon URL");
        res.statusCode = 404;
        res.end('incorrect query!');
    };
};