Ese es mi código:
var express = require('express');
var http = require('http');
var app = express();
var sql = require('mssql');
var path = require('path'),
html5 = require('ejs').__express;
app.set('port', process.env.PORT || 3000);
app.engine('.html', html5 );
app.set('views', __dirname + '/views');
app.set('view engine', 'html');
http.createServer(app).listen(app.get('port'), function(){
console.log('Express server listening on port ' + app.get('port'));
});
var config = {
user: 'dbo',
password: '',
server: 'localhost',
database: 'db_name'
}
sql.connect(config, function(err) {
// ... error checks
// Query
var request = new sql.Request();
request.query('select * from table_name', function(err, recordset) {
// ... error checks
console.log(recordset);
app.get('/', function(request, response) {
response.send(err);
});
});
});
En la consola de registros me puso el mensaje "undefined" and in localhots:3000 the message is: "Login failed; one or more errorMessage events should have been emitted" Estoy usando MSSQLSERVER 2012. Gracias por las respuestas.