Front-End To Back-End Connection

I have a front end webpage using html, css and js. I also have a back end using python code. The project is basically a URL Shortener Website. How can I connect the front-end with the back-end without a database and without using flask in python?

#my back-end code

import pyshorteners

import pyperclip

link=input(“Enter the link: “)

shortener=pyshorteners.Shortener()

x=shortener.tinyurl.short(link)

print(x)

pyperclip.copy(x)

#the input in the textbox on front-end should be transferred to the back-end and stored in the variable “link”. How can I achieve that? The shortened URL should also be sent back to the front end.

We tried using flask but since it was an absolutely new topic, we were unable to implement it. I couldn’t understand importing “templates” file in flask. Hence, the template of website was not loaded properly and the code showed error.

I dont know how to integrate Django or Nodejs. If the solution requires adding of these, then how can I install or import them?