I can get this code working on a node.js express server ok.
For some reason, I can't get a response when I try to put it in a serverless Azure function...
const createHandler = require("azure-function-express").createHandler;
const express = require('express');
const bodyParser = require('body-parser');
const tediousExpress = require('express4-tedious');
const app = express();
app.use(function (req, res, next) {
req.sql = tediousExpress({
"server" : process.env.sqlServer,
"userName": process.env.sqlUserName,
"password": process.env.sqlPassword,
"options": {
"encrypt": true,
"database": process.env.sqlDatabase
}
});
next();
});
app.use(bodyParser.text());
app.use(function (req, res) {
req.sql("select * from todo for json path")
.into(res, '[]');
});
module.exports = createHandler(app);
I can get this code working on a node.js express server ok.
For some reason, I can't get a response when I try to put it in a serverless Azure function...