I have an object I'd like to have inserted into a table in my MSSQL
DB.
According to the Seriate docs on github, this shouldn't be a problem.
My setup looks like this:
apiRoute.js
module.exports = function(express, schema) {
var apiRoute = express.Router();
apiRoute.post('/test-path', function(req, res) {
schema.test()
.then(function(results) {
res.json(results);
}, function(err) {
res.json(err);
});
});
return apiRoute;
}
schema.js
var sql = require('seriate');
var when = require('when');
var test = function() {
return sql.execute({
query: "select * from @children",
params: {
children: {
val: [
{ id: 1, firstName: "James", middleName: "Paul"},
{ id: 2, firstName: "John", middleName: "Winston" },
{ id: 3, firstName: "George", middleName: "Harold" },
{ id: 4, firstName: "Richard", middleName: "Parkin" }
],
asTable: {
id: sql.INT,
firstName: sql.NVARCHAR(50),
middleName: sql.NVARCHAR(50)
}
}
}
});
}
module.exports = {
test: test
}
When I test this with Postman, the requests just keeps going until it eventually just times out.
If I just execute a query without the asTable
part:
select 1
It works just fine.
What am I missing?