Here you can find example codes of webservers to make your projects pingable by Pinglik.
If you want to host your bot on repl.it 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 bot every 1 min so your project will stay online for 24/7. Here you can find example codes of webservers.
Javascript (NodeJS) webservers:
Express webserver:
// express Pinglik webserver example codeconstexpress=require("express");constapp=express();constport=process.env.PORT||3000;app.get("/", (req, res) => {res.send("<code>Hello, this project is using <a href='https://pinglik.eu' target='_blank'>Pinglik</a>!</code>" );});app.listen(port, () => {console.log(`📡 Pinglik webserver has started!`);});
Http webserver:
// http Pinglik webserver example codeconsthttp=require("http");constport=process.env.PORT||3000;constserver= http.createServer((req, res) => {res.writeHead(200, { "Content-Type":"text/html" });res.end("<code>Hello, this project is using <a href='https://pinglik.eu' target='_blank'>Pinglik</a>!</code>" ); }).listen(port);console.log(`📡 Pinglik webserver has started!`);
Python webservers:
Flask webserver:
# flask Pinglik webserver example codefrom flask import Flaskfrom threading import Threadapp =Flask(__name__)@app.route('/')defmain():return"<code>Hello, this project is using <a href='https://pinglik.eu' target='_blank'>Pinglik</a>!</code>"defrun(): app.run(host="0.0.0.0", port=3000)defkeep_alive(): server =Thread(target=run) server.start()print("📡 Pinglik webserver has started!")keep_alive()