This code is only compatible for python. For node.js, click me!
Open your main repl file (example: main.py etc...) and add keep_alive
to import line. Now create a new file named keep_alive.py
, then paste this script below:
from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def main():
return 'Please connect me into a hosting website to enable 24/7 hosting. ItzNexus#5354'
def run():
app.run(host="0.0.0.0", port=8080)
def keep_alive():
server = Thread(target=run)
server.start()
Run the repl, and copy the web address you see top right corner. And go to UptimeRobot and host your web address.