Creating webserver

Here you can find example codes of webservers to make your projects without webserver (like Discord bots) pingable by Pinglik Uptimer.

If you want to host your bot on replit or similiar service you need to create webserver for your project to make your project pingable. It means that you need to have there very simple website which will be pinged by Pinglik Uptimer so your project will stay online for 24/7. Here you can find example codes of webservers.

NodeJS Express webserver

// express Pinglik webserver example code
const express = require("express");
const app = express();
const port = process.env.PORT || 3000;

app.get("/", (req, res) => {
  res.send(
    "<code>Hello, this project is using <a href='https://uptimer.pinglik.eu' target='_blank'>Pinglik Uptimer</a>!<br>Our website: <a href='https://pinglik.eu' target='_blank'>pinglik.eu</a></code>"
  );
});

app.listen(port, () => {
  console.log(`📡 Pinglik webserver has started!`);
});

Python Flask webserver

# flask Pinglik webserver example code

from flask import Flask
from threading import Thread

app = Flask(__name__)

@app.route('/')
def main():
    return "<code>Hello, this project is using <a href='https://uptimer.pinglik.eu' target='_blank'>Pinglik Uptimer</a>!<br>Our website: <a href='https://pinglik.eu' target='_blank'>pinglik.eu</a></code>"

def run():
    app.run(host="0.0.0.0", port=3000)

def keep_alive():
    server = Thread(target=run)
    server.start()
    print("📡 Pinglik webserver has started!")

keep_alive()

Last updated