[mirotalksfu] - update dep.

This commit is contained in:
Miroslav Pejic
2023-07-26 14:58:27 +02:00
parent 5b2713472a
commit 9c0de3db45
3 changed files with 25 additions and 22 deletions
+21 -18
View File
@@ -1,22 +1,25 @@
const fetch = require('node-fetch');
async function getMeeting() {
try {
// Use dynamic import with await
const { default: fetch } = await import('node-fetch');
const API_KEY = 'mirotalk_default_secret';
// const MIROTALK_URL = 'http://localhost:3000/api/v1/meeting';
const MIROTALK_URL = 'https://p2p.mirotalk.com/api/v1/meeting';
// const MIROTALK_URL = 'https://mirotalk.up.railway.app/api/v1/meeting';
const API_KEY = 'mirotalk_default_secret';
// $MIROTALK_URL = "http://localhost:3000/api/v1/meeting";
MIROTALK_URL = 'https://p2p.mirotalk.com/api/v1/meeting';
// $MIROTALK_URL = "https://mirotalk.up.railway.app/api/v1/meeting";
function getResponse() {
return fetch(MIROTALK_URL, {
method: 'POST',
headers: {
authorization: API_KEY,
'Content-Type': 'application/json',
},
});
const response = await fetch(MIROTALK_URL, {
method: 'POST',
headers: {
authorization: API_KEY,
'Content-Type': 'application/json',
},
});
const data = await response.json();
console.log('meeting:', data.meeting);
} catch (error) {
console.error('Error fetching data:', error);
}
}
getResponse().then(async (res) => {
console.log('Status code:', res.status);
const data = await res.json();
console.log('meeting:', data.meeting);
});
getMeeting();