Refactor documentation for reverse proxy and routing guides
Deploy to Production / deploy (push) Successful in 5s

This commit is contained in:
Илья Глазунов
2025-12-08 01:05:52 +03:00
parent 58660ec8d4
commit 00119ce463
12 changed files with 521 additions and 517 deletions
+45 -45
View File
@@ -28,37 +28,37 @@
<h3>1. Create Configuration File</h3>
<p>Create a file named <code>config.yaml</code> in your project directory:</p>
<pre><span class="directive">http:</span>
<span class="directive">static_dir:</span> <span class="value">./static</span>
<span class="directive">templates_dir:</span> <span class="value">./templates</span>
<pre><code class="language-yaml">http:
static_dir: ./static
templates_dir: ./templates
<span class="directive">server:</span>
<span class="directive">host:</span> <span class="value">0.0.0.0</span>
<span class="directive">port:</span> <span class="value">8080</span>
server:
host: 0.0.0.0
port: 8080
<span class="directive">logging:</span>
<span class="directive">level:</span> <span class="value">INFO</span>
<span class="directive">console_output:</span> <span class="value">true</span>
logging:
level: INFO
console_output: true
<span class="directive">extensions:</span>
- <span class="directive">type:</span> <span class="value">routing</span>
<span class="directive">config:</span>
<span class="directive">regex_locations:</span>
<span class="value">"__default__"</span>:
<span class="directive">root:</span> <span class="value">"./static"</span>
<span class="directive">index_file:</span> <span class="value">"index.html"</span></pre>
extensions:
- type: routing
config:
regex_locations:
"__default__":
root: "./static"
index_file: "index.html"</code></pre>
<h3>2. Create Static Directory</h3>
<p>Create a <code>static</code> folder and add an <code>index.html</code>:</p>
<pre>mkdir -p static
echo '&lt;h1&gt;Hello from pyserve!&lt;/h1&gt;' &gt; static/index.html</pre>
<pre><code class="language-bash">mkdir -p static
echo '&lt;h1&gt;Hello from pyserve!&lt;/h1&gt;' &gt; static/index.html</code></pre>
<h3>3. Start the Server</h3>
<pre>pyserve</pre>
<pre><code class="language-bash">pyserve</code></pre>
<p>You should see output like:</p>
<pre>Starting PyServe server on 0.0.0.0:8080</pre>
<pre><code class="language-plaintext">Starting PyServe server on 0.0.0.0:8080</code></pre>
<h3>4. Open in Browser</h3>
<p>Navigate to <a href="http://localhost:8080">http://localhost:8080</a> — you should see your page!</p>
@@ -66,44 +66,44 @@ echo '&lt;h1&gt;Hello from pyserve!&lt;/h1&gt;' &gt; static/index.html</pre>
<h3>Using CLI Options</h3>
<p>Override configuration via command line:</p>
<pre><span class="comment"># Use a different config file</span>
<pre><code class="language-bash"># Use a different config file
pyserve -c /path/to/config.yaml
<span class="comment"># Override host and port</span>
# Override host and port
pyserve --host 127.0.0.1 --port 9000
<span class="comment"># Enable debug mode (verbose logging)</span>
pyserve --debug</pre>
# Enable debug mode (verbose logging)
pyserve --debug</code></pre>
<h3>Example: Serve Documentation</h3>
<p>Serve a documentation directory with proper caching:</p>
<pre><span class="directive">http:</span>
<span class="directive">static_dir:</span> <span class="value">./docs</span>
<pre><code class="language-yaml">http:
static_dir: ./docs
<span class="directive">server:</span>
<span class="directive">host:</span> <span class="value">0.0.0.0</span>
<span class="directive">port:</span> <span class="value">8000</span>
server:
host: 0.0.0.0
port: 8000
<span class="directive">extensions:</span>
- <span class="directive">type:</span> <span class="value">routing</span>
<span class="directive">config:</span>
<span class="directive">regex_locations:</span>
<span class="value">"=/"</span>:
<span class="directive">root:</span> <span class="value">"./docs"</span>
<span class="directive">index_file:</span> <span class="value">"index.html"</span>
extensions:
- type: routing
config:
regex_locations:
"=/":
root: "./docs"
index_file: "index.html"
<span class="value">"~*\\.(css|js)$"</span>:
<span class="directive">root:</span> <span class="value">"./docs"</span>
<span class="directive">cache_control:</span> <span class="value">"public, max-age=3600"</span>
"~*\\.(css|js)$":
root: "./docs"
cache_control: "public, max-age=3600"
<span class="value">"~*\\.html$"</span>:
<span class="directive">root:</span> <span class="value">"./docs"</span>
<span class="directive">cache_control:</span> <span class="value">"no-cache"</span>
"~*\\.html$":
root: "./docs"
cache_control: "no-cache"
<span class="value">"__default__"</span>:
<span class="directive">root:</span> <span class="value">"./docs"</span>
<span class="directive">index_file:</span> <span class="value">"index.html"</span></pre>
"__default__":
root: "./docs"
index_file: "index.html"</code></pre>
<div class="note">
<strong>Next Steps:</strong>