Skip to content

Instantly share code, notes, and snippets.

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 == 'undefined') {
context.res = {
status: 400,
body: "Please specify the name of the function to enable"
else {
var functionJsonPath = path.join(__dirname, '..',, '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
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.