require('dotenv').config();constexpress=require('express');constaxios=require('axios');constbodyParser=require('body-parser');constpino=require('express-pino-logger')();constapp=express();app.use(bodyParser.urlencoded({ extended:false }));app.use(pino);app.get('/api/get-speech-token',async (req, res, next) => {res.setHeader('Content-Type','application/json');constspeechKey=process.env.SPEECH_KEY;constspeechRegion=process.env.SPEECH_REGION;if (speechKey ==='paste-your-speech-key-here'|| speechRegion ==='paste-your-speech-region-here') {res.status(400).send('You forgot to add your speech key or region to the .env file.'); } else {constheaders= { headers: {'Ocp-Apim-Subscription-Key': speechKey,'Content-Type':'application/x-www-form-urlencoded' } };try {consttokenResponse=awaitaxios.post(`https://${speechRegion}.api.cognitive.microsoft.com/sts/v1.0/issueToken`,null, headers);res.send({ token:tokenResponse.data, region: speechRegion }); } catch (err) {res.status(401).send('There was an error authorizing your speech key.'); } }});app.listen(3001, () =>console.log('Express server is running on localhost:3001'));