This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { deleteEntity } = require("../services/table-service"); | |
module.exports = async function (context, req) { | |
try { | |
const { blog, id } = context.bindingData; | |
const entity = { | |
PartitionKey: { _: blog }, | |
RowKey: { _: id.toString() }, | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const deleteEntity = (table, entity) => { | |
return new Promise((resolve, reject) => { | |
tableSvc.deleteEntity(table, entity, function (error, result, response) { | |
if (error) { | |
reject(error); | |
} else { | |
resolve(); | |
} | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { updateEntity } = require("../services/table-service"); | |
module.exports = async function (context, req) { | |
try { | |
if (!req.body) { | |
context.res = { | |
status: 400, | |
body: "Request body required", | |
}; | |
return; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const updateEntity = (table, entity) => { | |
return new Promise((resolve, reject) => { | |
tableSvc.mergeEntity(table, entity, function (error, result, response) { | |
if (error) { | |
reject(error); | |
} else { | |
resolve(); | |
} | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const azure = require("azure-storage"); | |
const { queryEntities } = require("../services/table-service"); | |
module.exports = async function (context, req) { | |
try { | |
const { blog, id } = context.bindingData; | |
var query = new azure.TableQuery() | |
.where("PartitionKey eq ?", blog) | |
.and("RowKey eq ?", id.toString()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"bindings": [ | |
{ | |
"authLevel": "anonymous", | |
"type": "httpTrigger", | |
"direction": "in", | |
"name": "req", | |
"methods": [ | |
"get" | |
], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const azure = require("azure-storage"); | |
const { queryEntities } = require("../services/table-service"); | |
module.exports = async function (context, req) { | |
try { | |
const blog = context.bindingData.blog; | |
if (!blog) { | |
context.res = { | |
status: 400, | |
body: "Blog ID is required", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const queryEntities = (tableName, query) => { | |
return new Promise((resolve, reject) => { | |
tableSvc.queryEntities( | |
tableName, | |
query, | |
null, | |
{ payloadFormat: "application/json;odata=nometadata" }, | |
function (error, result, response) { | |
if (error) { | |
reject(error); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { insertEntity } = require("../services/table-service"); | |
module.exports = async function (context, req) { | |
try { | |
if (!req.body) { | |
context.res = { | |
status: 400, | |
body: "Request body required", | |
}; | |
return; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"bindings": [ | |
{ | |
"authLevel": "anonymous", | |
"type": "httpTrigger", | |
"direction": "in", | |
"name": "req", | |
"methods": [ | |
"post" | |
] |
NewerOlder