test 2
This commit is contained in:
parent
fb88dc5137
commit
d2f0d951c6
17
fetchTest.js
Normal file
17
fetchTest.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
const apiUrl = 'https://ubs.rtech.foundation/api/v1/info'; // Replace with your API URL
|
||||
const interval = 1000; // 1 second
|
||||
|
||||
const callApi = async () => {
|
||||
try {
|
||||
const response = await fetch(apiUrl);
|
||||
if (!response.ok) {
|
||||
throw new Error('Network response was not ok');
|
||||
}
|
||||
const data = await response.json();
|
||||
console.log('API Response:', data);
|
||||
} catch (error) {
|
||||
console.error('Error calling API:', error.message);
|
||||
}
|
||||
};
|
||||
|
||||
setInterval(callApi, interval);
|
|
@ -4,6 +4,8 @@ if (!global.rateLimitList) {
|
|||
global.rateLimitList = {};
|
||||
}
|
||||
|
||||
console.log(process.env)
|
||||
|
||||
const middleware = (req, res, next) => {
|
||||
// X requests per Y seconds per IP address
|
||||
const maxRequests = process.env.RATE_LIMIT_MAX || 30;
|
||||
|
|
Loading…
Reference in a new issue