Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function to disable a function
var fs = require('fs');
var path = require('path');
module.exports = function (context, req) {
if (typeof req.query.name == 'undefined') {
context.res = {
status: 400,
body: "Please specify the name of the function to enable"
}
}
else {
var functionJsonPath = path.join(__dirname, '..', req.query.name, 'function.json');
var definition = JSON.parse(fs.readFileSync(functionJsonPath, {encoding: 'utf8'}));
definition.disabled = false;
fs.writeFileSync(functionJsonPath, JSON.stringify(definition));
context.res = {
// test
body: "Set function disabled status to: " + definition.disabled
}
}
context.done();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.