Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
expressBrowserify('public/client.js', {
watch: isDev,
debug: isDev
})
);
app.use(express.static('public/'));
// optional: load environment properties from a .env file
dotenv.load({ silent: true });
// For local development, specify the username and password or set env properties
var ltAuthService = new AuthorizationV1({
username: process.env.TONE_ANALYZER_USERNAME || '',
password: process.env.TONE_ANALYZER_PASSWORD || '',
url: ToneAnalyzerV3.URL
});
app.get('/api/token/tone_analyzer', function(req, res) {
ltAuthService.getToken(function(err, token) {
if (err) {
console.log('Error retrieving token: ', err);
return res.status(500).send('Error retrieving token');
}
res.send(token);
});
});
var port = process.env.PORT || process.env.VCAP_APP_PORT || 3000;
app.listen(port, function() {
console.log('Watson browserify example server running at http://localhost:%s/', port);
});
app.use(
webpackDevMiddleware(compiler, {
publicPath: '/' // Same as `output.publicPath` in most cases.
})
);
app.use(express.static('public/'));
// optional: load environment properties from a .env file
dotenv.load({ silent: true });
// For local development, specify the username and password or set env properties
var ltAuthService = new AuthorizationV1({
username: process.env.TONE_ANALYZER_USERNAME || '',
password: process.env.TONE_ANALYZER_PASSWORD || '',
url: ToneAnalyzerV3.URL
});
app.get('/api/token/tone_analyzer', function(req, res) {
ltAuthService.getToken(function(err, token) {
if (err) {
console.log('Error retrieving token: ', err);
return res.status(500).send('Error retrieving token');
}
res.send(token);
});
});
var port = process.env.PORT || process.env.VCAP_APP_PORT || 3000;
app.listen(port, function() {
console.log('Watson browserify example server running at http://localhost:%s/', port);
});