我使用Azure Easy Tables创建了一个简单的后端,我想知道如何使用Azure Functions来执行CRUD。现在我正在使用javascript客户端SDK并将其放在我的网站上,但我知道至少可以说这根本不是安全的。
目前,我正在使用触发的Azure功能发送电子邮件。然后我从我的网站上调用此功能。我想为我的CRUD操作做同样的事情。任何帮助表示赞赏!
module.exports = function (context, requ) {
context.log('JavaScript HTTP trigger function processed a request.');
var http = require("https");
var options = {
"method": "POST",
"hostname": "EMAIL.API",
"port": null,
"path": "mail/send",
"headers": {
"authorization": "AUTH",
"content-type": "application/json"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify(
{ personalizations:
[ { to: [ { email: requ.query.email, name: requ.query.name } ],
subject: 'AutoConscience Registration' } ],
from: { email: 'noreply@conscience.ac', name: 'AutoConscience Support Team' },
reply_to: { email: '', name: 'alcovesdev' },
subject: 'AutoConscience Registration',