20
20
21
21
const express = require ( 'express' ) ;
22
22
const 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' ) ;
24
26
const vcapServices = require ( 'vcap_services' ) ;
25
27
const expressBrowserify = require ( 'express-browserify' ) ;
26
28
const webpackDevMiddleware = require ( 'webpack-dev-middleware' ) ;
@@ -82,7 +84,7 @@ app.use(
82
84
// **Warning**: these endpoints should probably be guarded with additional authentication & authorization for production use
83
85
84
86
// speech to text token endpoint
85
- var sttAuthService = new watson . AuthorizationV1 (
87
+ var sttAuthService = new AuthorizationV1 (
86
88
Object . assign (
87
89
{
88
90
username : process . env . SPEECH_TO_TEXT_USERNAME , // or hard-code credentials here
@@ -94,7 +96,7 @@ var sttAuthService = new watson.AuthorizationV1(
94
96
app . use ( '/api/speech-to-text/token' , function ( req , res ) {
95
97
sttAuthService . getToken (
96
98
{
97
- url : watson . SpeechToTextV1 . URL
99
+ url : SpeechToTextV1 . URL
98
100
} ,
99
101
function ( err , token ) {
100
102
if ( err ) {
@@ -108,7 +110,7 @@ app.use('/api/speech-to-text/token', function(req, res) {
108
110
} ) ;
109
111
110
112
// text to speech token endpoint
111
- var ttsAuthService = new watson . AuthorizationV1 (
113
+ var ttsAuthService = new AuthorizationV1 (
112
114
Object . assign (
113
115
{
114
116
username : process . env . TEXT_TO_SPEECH_USERNAME , // or hard-code credentials here
@@ -120,7 +122,7 @@ var ttsAuthService = new watson.AuthorizationV1(
120
122
app . use ( '/api/text-to-speech/token' , function ( req , res ) {
121
123
ttsAuthService . getToken (
122
124
{
123
- url : watson . TextToSpeechV1 . URL
125
+ url : TextToSpeechV1 . URL
124
126
} ,
125
127
function ( err , token ) {
126
128
if ( err ) {
0 commit comments