{"size": 1266, "ext": "js", "max_stars_repo_path": "ReservamosService/server.js", "max_stars_repo_name": "pabloeferreyra/AppAndroidReservas", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "ReservamosService/server.js", "max_issues_repo_name": "pabloeferreyra/AppAndroidReservas", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "ReservamosService/server.js", "max_forks_repo_name": "pabloeferreyra/AppAndroidReservas", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 30.1428571429, "max_line_length": 82, "alphanum_fraction": 0.6003159558}

var express = require('express'); // Web Framework
var app = express();
var sql = require('mssql'); // MS Sql Server client

var dbConfig = {
    user:  "User",
    password: "4Dmini57r470r",
    server: "localhost\\SQLEXPRESS",
    port: 1433,
    database: "Reservamos"
};

// Start server and listen on http://localhost:8081/
var server = app.listen(8081, function () {
    var host = server.address().address
    var port = server.address().port

    console.log("app listening at http://%s:%s", host, port)
});


app.get('/locales/:id/', function (req, res) {
    sql.connect(dbConfig, function () {
        var request = new sql.Request();
        var stringRequest = 'select * from [Locales] where ID = ' + req.params.id;
        request.query(stringRequest, function (err, recordset) {
            if (err) console.log(err);
            res.end(JSON.stringify(recordset)); // Result in JSON format
        });
    });
})

app.get("/locales", function (req, res) {
    sql.connect(dbConfig, function () {
        var request = new sql.Request();
        request.query('select * from [Locales]', function (err, recordset) {
            if (err) console.log(err);
            res.end(JSON.stringify(recordset)); // Result in JSON format
        });
    });
});