Make Notifications from server.js to app.js interface methods

Would it be possible to make interface events (notifications) work through server.js? Is it possible to access elements in app.js using server.js?

In server.js

function showNotification() {
    let elem = document.getElementById("rateLimit");
    elem.style.display = 'block';
}

rateLimit div is in app.js

I am getting an error saying the document is not available.

Hi @thimayarohit,

Greetings!

I’m afraid this can’t be done.

The front end and back end are handled differently.

The term “document object” typically refers to the Document Object Model (DOM), which is a JavaScript programming interface used in web browsers for representing web pages. The DOM is specific to the front end and is not applicable to the back end.

The front-end code and the back-end code runs separately

its like consoling the document object in the node.js app…

If you want to handle 429 errors (ratelimit error), you can use the status code from the response/error to check and update the UI accordingly.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.