Almas-Ali / backkr

A backend framework the web

Home Page:https://almas-ali.github.io/backkr

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Backkr - A backend framework the web

Created by @Almas-Ali

Table of Contents

Introduction

Try out the examples/ folder to see how to use the framework.

Installation

pip install backkr

Usage

from datetime import datetime

from backkr import (
    Backkr,
    HTMLResponse
)

app = Backkr()

@app.get('/')
async def index(request):
    return HTMLResponse(
        '<h1>Hello World, Time: {{ time }}</h1>',
        time=datetime.now().strftime("%H:%M:%S")
    )

@app.get('/{path}')
async def error_404(request):
    path = request.match_info.get('path')
    return HTMLResponse(f'''\
<center>
    <h1>404 Not Found</h1>
    <p>Page /{path} not found</p>
</center>
''')


if __name__ == "__main__":
    app.run(
        debug=True,
        host='127.0.0.1',
        port=8000
    )

Documentation

Website

LICENSE

Licensed under the MIT LICENSE

About

A backend framework the web

https://almas-ali.github.io/backkr

License:MIT License


Languages

Language:Python 100.0%