2020
2121const express = require ( 'express' ) ;
2222const app = express ( ) ;
23- const watson = require ( 'watson-developer-cloud' ) ;
23+ const AuthorizationV1 = require ( 'watson-developer-cloud/authorization/v1' ) ;
24+ const SpeechToTextV1 = require ( 'watson-developer-cloud/speech-to-text/v1' ) ;
25+ const TextToSpeechV1 = require ( 'watson-developer-cloud/text-to-speech/v1' ) ;
2426const vcapServices = require ( 'vcap_services' ) ;
2527const expressBrowserify = require ( 'express-browserify' ) ;
2628const webpackDevMiddleware = require ( 'webpack-dev-middleware' ) ;
@@ -82,7 +84,7 @@ app.use(
8284// **Warning**: these endpoints should probably be guarded with additional authentication & authorization for production use
8385
8486// speech to text token endpoint
85- var sttAuthService = new watson . AuthorizationV1 (
87+ var sttAuthService = new AuthorizationV1 (
8688 Object . assign (
8789 {
8890 username : process . env . SPEECH_TO_TEXT_USERNAME , // or hard-code credentials here
@@ -94,7 +96,7 @@ var sttAuthService = new watson.AuthorizationV1(
9496app . use ( '/api/speech-to-text/token' , function ( req , res ) {
9597 sttAuthService . getToken (
9698 {
97- url : watson . SpeechToTextV1 . URL
99+ url : SpeechToTextV1 . URL
98100 } ,
99101 function ( err , token ) {
100102 if ( err ) {
@@ -108,7 +110,7 @@ app.use('/api/speech-to-text/token', function(req, res) {
108110} ) ;
109111
110112// text to speech token endpoint
111- var ttsAuthService = new watson . AuthorizationV1 (
113+ var ttsAuthService = new AuthorizationV1 (
112114 Object . assign (
113115 {
114116 username : process . env . TEXT_TO_SPEECH_USERNAME , // or hard-code credentials here
@@ -120,7 +122,7 @@ var ttsAuthService = new watson.AuthorizationV1(
120122app . use ( '/api/text-to-speech/token' , function ( req , res ) {
121123 ttsAuthService . getToken (
122124 {
123- url : watson . TextToSpeechV1 . URL
125+ url : TextToSpeechV1 . URL
124126 } ,
125127 function ( err , token ) {
126128 if ( err ) {
0 commit comments