 
        < Previous Challenge - Home - Next Challenge >
In this challenge, you will create two new Azure Functions written in Node.js, using VS Code. These will be triggered by Event Grid and output to Azure Cosmos DB to save the results of license plate processing done earlier by the ProcessImage function.  The code for these functions is provided in the challenge instructions below.
Two notes about the code you will use:
Since these new functions will be written in a different language than the ones from the previous challenge (Node.js vs. C#), you will need to open a new Visual Studio code window.
Open Folder from the “hamburger menu” in the upper left corner of the screenEvents folder from the drop down that appears at the top of the VS Code window and click OKEvents folder.Using the skills you learned in Challenge 02 when creating a “Hello World” function, you will create two new functions and deploy each both to the Function App in Azure with the events in the name that you created earlier in Challenge 03.
savePlateData FunctionEvents folder.savePlateDatasavePlateData.js file with the following:const { app, output } = require('@azure/functions'); 
const cosmosOutput = output.cosmosDB({ 
    databaseName: 'LicensePlates', 
    containerName: 'Processed', 
    createIfNotExists: true, 
    connection: 'cosmosDBConnectionString', 
}); 
app.eventGrid('savePlateData', { 
    return: cosmosOutput, 
    handler: (event, context) => { 
        context.log('Event grid function processed event:', event); 
        return { 
            fileName: event.data['fileName'], 
            licensePlateText: event.data['licensePlateText'], 
            timeStamp: event.data['timeStamp'], 
            exported: false,
            id: event.id 
        }; 
    }, 
}); 
savePlateData function to the Function App with events in the name, from the Azure “Workspace” Local Project you just created.cosmosDBConnectionString with the connection string (or the corresponding KeyVault Secret reference) to Cosmos DB LicensePlatessavePlateData, and go to Integration. From the Event Grid Trigger, add an event grid subscription
    SAVE"savePlateDataSavePlateData Function.queuePlateForManualCheckup FunctionNow let’s repeat the same steps for the second event function:
queuePlateForManualCheckupqueuePlateForManualCheckup.js file with the following:const { app, output } = require('@azure/functions'); 
const cosmosOutput = output.cosmosDB({ 
    databaseName: 'LicensePlates', 
    containerName: 'NeedsManualReview', 
    createIfNotExists: true, 
    connection: 'cosmosDBConnectionString', 
}); 
app.eventGrid('queuePlateForManualCheckup', { 
    return: cosmosOutput, 
    handler: (event, context) => { 
        context.log('Event grid function processed event:', event); 
        return { 
            fileName: event.data['fileName'], 
            licensePlateText: '', 
            timeStamp: event.data['timeStamp'], 
            resolved: false,
            id: event.id
        };
    },
});
queuePlateForManualCheckup function to the Function App with events in the name, from the Azure “Workspace” Local Project.cosmosDBConnectionString with the connection string (or the corresponding KeyVault Secret reference) to Cosmos DB LicensePlatesqueuePlateForManualCheckup, and go to Integration. From the Event Grid Trigger, add an event grid subscription
    QUEUE”queuePlateForManualCheckupqueuePlateForManualCheckup Function.events/
        host.jsonpackage.jsonevents/src/functions/
        savePlateData.jsqueuePlateForManualCheckup.jsLiveStream, upload a License Plate JPG to the storage account, and validate the event functions are called with the license plate filename, timestamp and text (if successful).