Илья Глазунов 00119ce463
All checks were successful
Deploy to Production / deploy (push) Successful in 5s
Refactor documentation for reverse proxy and routing guides
2025-12-08 01:05:52 +03:00

125 lines
3.7 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Quick Start - pyserve</title>
<link rel="stylesheet" href="../style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
<script>hljs.highlightAll();</script>
</head>
<body>
<div id="container">
<div id="header">
<h1>pyserve</h1>
<div class="tagline">python application orchestrator</div>
</div>
<div class="breadcrumb">
<a href="../index.html">Home</a> / <a href="index.html">Getting Started</a> / Quick Start
</div>
<div id="content">
<h2>Quick Start</h2>
<p>Get pyserve running in under 5 minutes.</p>
<h3>1. Create Configuration File</h3>
<p>Create a file named <code>config.yaml</code> in your project directory:</p>
<pre><code class="language-yaml">http:
static_dir: ./static
templates_dir: ./templates
server:
host: 0.0.0.0
port: 8080
logging:
level: INFO
console_output: true
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><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><code class="language-bash">pyserve</code></pre>
<p>You should see output like:</p>
<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>
<h3>Using CLI Options</h3>
<p>Override configuration via command line:</p>
<pre><code class="language-bash"># Use a different config file
pyserve -c /path/to/config.yaml
# Override host and port
pyserve --host 127.0.0.1 --port 9000
# Enable debug mode (verbose logging)
pyserve --debug</code></pre>
<h3>Example: Serve Documentation</h3>
<p>Serve a documentation directory with proper caching:</p>
<pre><code class="language-yaml">http:
static_dir: ./docs
server:
host: 0.0.0.0
port: 8000
extensions:
- type: routing
config:
regex_locations:
"=/":
root: "./docs"
index_file: "index.html"
"~*\\.(css|js)$":
root: "./docs"
cache_control: "public, max-age=3600"
"~*\\.html$":
root: "./docs"
cache_control: "no-cache"
"__default__":
root: "./docs"
index_file: "index.html"</code></pre>
<div class="note">
<strong>Next Steps:</strong>
<ul class="indent">
<li><a href="../guides/process-orchestration.html">Process Orchestration</a> — Run apps in isolated processes</li>
<li><a href="../guides/configuration.html">Configuration Guide</a> — Full configuration reference</li>
<li><a href="../guides/routing.html">Routing Guide</a> — nginx-style URL patterns</li>
<li><a href="../guides/reverse-proxy.html">Reverse Proxy</a> — Proxy to backend services</li>
</ul>
</div>
</div>
<div id="footer">
<p>pyserve &copy; 2024-2025 | MIT License</p>
</div>
</div>
</body>
</html>