Created
March 14, 2016 14:22
-
-
Save mathamoz/1f4f924b24e5e2a98779 to your computer and use it in GitHub Desktop.
FS Node Express
This file contains 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
var express = require('express'); | |
var featureswitches = require('featureswitches')('customer_key', 'environment_key'); | |
var app = express(); | |
featureswitches.sync(); | |
app.get('/', function(req, res) { | |
featureswitches.is_enabled('world') | |
.then(function(result) { | |
if (result instanceof Error) { | |
res.send('Error...'); | |
} else { | |
if(result == true) { | |
res.send('Hello World!'); | |
} else { | |
res.send('Hello USA!'); | |
} | |
} | |
}); | |
}); | |
app.listen(3000, function() { | |
console.log('Listening on port 3000!'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment