Metadata-Version: 2.4
Name: qseweb
Version: 1.0.4
Summary: High-performance Flask-like web framework with C++ backend
Author: Qarvexium
License: MIT
Keywords: web,framework,http,server,flask,async,performance,c++
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: C++
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# QSEWeb

High-performance web framework with C++ backend. Call Python from JavaScript easily.

## Install

```bash
pip install qseweb
```

## Example

```python
import qseweb

app = qseweb.QSEWeb()

@app.assign("Btn")
def button():
    print("Button clicked")
    return "success"

@app.serve("/")
def main():
    return """
    <html>
    <body>
        <h1>Click the button</h1>
        <button onclick="button()">Click me</button>
        
        <script>
        async function button() {
            const response = await qse.Btn();
            alert(response);
        }
        </script>
    </body>
    </html>
    """

print("Starting server on http://localhost:5000")
app.run()
```

That's it! Run it and click the button.

## How it works

1. Use `@app.assign("name")` to expose Python functions
2. Call them from JavaScript with `await qse.name()`
3. Python function runs, returns result to JavaScript

## API

### Create app
```python
app = qseweb.QSEWeb()              # Default: 0.0.0.0:5000
app = qseweb.QSEWeb(port=8080)     # Custom port
```

### Make routes
```python
@app.serve("/")
def home():
    return "<h1>Hello</h1>"

@app.serve("/about")
def about():
    return "<h1>About page</h1>"
```

### Call Python from JavaScript
```python
@app.assign("greet")
def greet(name):
    return f"Hello {name}!"
```

```javascript
const msg = await qse.greet("World");  // "Hello World!"
```

### Get request data
```python
@app.serve("/api")
def api(request):
    user_id = request['query'].get('id')    # Query params
    method = request['method']              # GET, POST, etc
    path = request['path']                  # URL path
    body = request.get('body', '')          # Request body
    return f"User: {user_id}"
```

### Stop server
```python
app.stop()

# Or from web:
@app.serve("/shutdown")
def shutdown():
    import threading
    threading.Thread(target=app.stop, daemon=True).start()
    return "Stopping..."
```

## Examples

```bash
python examples/basic.py              # Hello world
python examples/javascript_bridge.py  # JS ↔ Python
python examples/server_control.py     # Start/stop
python examples/advanced.py           # Full demo
```

## Features

- ✅ Flask-like API
- ✅ Call Python from JavaScript (`qse.function()`)
- ✅ Multi-threaded C++ backend
- ✅ Fast routing
- ✅ Async with Ctrl+C support
- ✅ Pre-compiled (no build needed)

## Requirements

- Python 3.7+
- Windows (pre-compiled .pyd included)

## License

MIT
