> For the complete documentation index, see [llms.txt](https://docs.pinglik.eu/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pinglik.eu/guide/creating-webserver.md).

# Creating webserver

> 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:

```javascript
// 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://pinglik.eu' target='_blank'>Pinglik</a>!</code>"
  );
});

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

### Http webserver:

```javascript
// http Pinglik webserver example code
const http = require("http");
const port = process.env.PORT || 3000;
const server = 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!`);
```

![Example response](/files/-MPEb6tPtCqSqs78yqUs)

## *`Python webservers:`*

### Flask webserver:

```python
# 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://pinglik.eu' target='_blank'>Pinglik</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()
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.pinglik.eu/guide/creating-webserver.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
