Now that are done with defining the routes and updating the model, we will work on the logic discussed in the Solution design section earlier. We are going to add a new method to CloudAIAPI named uploadVideo. Open server/controllers/cloud-ai-api.ts, and we will first add the required imports and the VideoIntelligenceServiceClient configuration. Before the class definition, add the following code:
// SNIPP SNIPPconst video = require('@google-cloud/video-intelligence').v1; const client = new video.VideoIntelligenceServiceClient({ credentials: JSON.parse(process.env.GCP_SK_CREDENTIALS) });// SNIPP SNIPP
Using the environment variable we have set in the .env file, we are using the GCP_SK_CREDENTIALS value to initialize ...