Defining routes

Now that we have the required dependencies, we will update the routes. To work with the Natural Language API, we are going to add only one route that will accept the text and respond back with the Natural Language response. Update server\routes\cloud-ai-api.ts and add the upload-audio route as shown in the following code:

// SNIPP SNIPProuter.post('/upload-image/:threadId', Authenticate, Authorize('user'), upload.single('image-reply'), cloudAIAPI.uploadImage);router.post('/upload-video/:threadId', Authenticate, Authorize('user'), upload.single('video-reply'), cloudAIAPI.uploadVideo);\router.post('/upload-audio/:threadId', Authenticate, Authorize('user'), upload.single('audio-reply'), cloudAIAPI.uploadAudio);router.post('/post-message', ...

Get Google Cloud AI Services Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.