{"id":19700986,"url":"https://github.com/erinshek/bizapi","last_synced_at":"2025-06-27T04:33:13.129Z","repository":{"id":257816122,"uuid":"869458340","full_name":"erinshek/bizapi","owner":"erinshek","description":"Web Framework for Python","archived":false,"fork":false,"pushed_at":"2024-10-20T04:25:32.000Z","size":60,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-31T14:32:02.495Z","etag":null,"topics":["library","opensource","python","webframework"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/BizAPI","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/erinshek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-08T10:30:17.000Z","updated_at":"2025-01-12T18:26:27.000Z","dependencies_parsed_at":"2025-02-27T20:36:32.506Z","dependency_job_id":"805b4241-d20f-4bd9-9618-4dea06d8975f","html_url":"https://github.com/erinshek/bizapi","commit_stats":null,"previous_names":["turdibekjumabaev/oneapi","erinshek/bizapi","turdibekjumabaev/bizapi"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/erinshek/bizapi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erinshek%2Fbizapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erinshek%2Fbizapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erinshek%2Fbizapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erinshek%2Fbizapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erinshek","download_url":"https://codeload.github.com/erinshek/bizapi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erinshek%2Fbizapi/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262188396,"owners_count":23272341,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["library","opensource","python","webframework"],"created_at":"2024-11-11T21:07:36.281Z","updated_at":"2025-06-27T04:33:13.105Z","avatar_url":"https://github.com/erinshek.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://telegra.ph/BizAPI-10-18\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/turdibekjumabaev/turdibekjumabaev/refs/heads/main/host/bizapi-logo.png\" alt=\"BizAPI\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003eA Lightweight Web Framework for Python\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cimg alt=\"PyPI - License\" src=\"https://img.shields.io/pypi/l/BizAPI\"\u003e\n    \u003cimg alt=\"PyPI - Downloads\" src=\"https://img.shields.io/pypi/dm/BizAPI\"\u003e\n    \u003cimg alt=\"PyPI - Status\" src=\"https://img.shields.io/pypi/status/BizAPI\"\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/turdibekjumabaev/bizapi\" target=\"_blank\"\u003e\u003cb\u003eSource Code\u003c/b\u003e\u003c/a\u003e and \u003ca href=\"https://telegra.ph/BizAPI-10-18\" target=\"_blank\"\u003e\u003cb\u003eInformation\u003c/b\u003e\u003c/a\u003e about BizAPI\n\u003c/p\u003e\n\n---\n\n## Contents\n\n  * [Installation](#installation)\n  * [Quick Start](#quick-start)\n  * [Routing](#routing)\n    * [Function-Based](#function-based-routing)\n    * [Parameterized](#parameterized-routing)\n    * [Allowed Methods](#allowed-methods)\n    * [Class-Based](#class-based-routing)\n    * [Simple Router](#simple-router)\n  * [Templates](#templates)\n  * [Exception Handler](#exception-handler)\n  * [Custom Responses](#custom-response)\n  * [Middleware](#middleware)\n\n---\n\n## Installation\n\nTo install BizAPI, use the following command:\n```\npip install BizAPI\n```\n\n---\n\n## Quick Start\nCreate a simple application using BizAPI:\n````python\nfrom bizapi import BizAPI\nfrom bizapi.types import Request, Response\n\napp = BizAPI()\n\n\n@app.route('/')\ndef home(request: Request, response: Response):\n    response.text = 'This is the home page'\n\n````\nRun the application using Gunicorn:\n````shell\ngunicorn main:app\n````\n\n---\n## Routing\n### Function-Based Routing\n```python\n@app.route('/')\ndef index(request: Request, response: Response):\n    response.text = \"Hello World!\"\n```\n\n### Parameterized Routing\n```python\n@app.route('/say-hello/{name}')\ndef sayhello(request: Request, response: Response, name: str):\n    response.text = f\"Assalawma áleykum {name}\"\n```\n\n### Allowed Methods\n```python\n@app.route('/article', methods=['POST'])\ndef create_article(request: Request, response: Response):\n    # Create a new article\n    pass\n\n\n@app.route('/article', methods=['GET'])\ndef get_article(request: Request, response: Response):\n    # Get an article\n    pass\n```\n\nYou can also use the method-specific decorators:\n```python\n@app.post('/article')\ndef create_product(request: Request, response: Response):\n    # Create a new article\n    pass\n\n\n@app.get('/article')\ndef get_product(request: Request, response: Response):\n    # Get an article\n    pass\n```\n\n### Class-Based Routing\n```python\n@app.route('/article')\nclass Article:\n    def get(request: Request, response: Response):\n        # Get an article\n        pass\n    \n    def post(request: Request, response: Response):\n        # Create a new article\n        pass\n```\n\n### Simple Router\n```python\ndef create_article(request: Request, response: Response):\n    response.text = \"A new article has been created\"\n\n\napp.register_route('/article', create_article, ['POST'])\n```\n\n---\n\n## Templates\n\n```python\nfrom bizapi import render_template\n\n@app.route('/hello')\ndef hello_page(request: Request, response: Response):\n    response.html = render_template('hello.html', name=\"John\")\n\n\n\n# Second way\n@app.route('/say-hello', methods=['GET'])\ndef home_page(request: Request, response: Response):\n    response.html = render_template('hello.html', {\n        'title': 'Say Hello!',\n        'name': 'John'\n    })\n```\n\n`templates/hello.txt`\n```html\n\u003chtml\u003e\n    \u003chead\u003e\u003ctitle\u003eHello\u003c/title\u003e\u003c/head\u003e\n    \u003cbody\u003e\u003cp\u003eHello, {{name}}\u003c/p\u003e\u003c/body\u003e\n\u003c/html\u003e\n```\n\n---\n\n## Exception Handler\nAdd a custom exception handler to manage errors:\n```python\ndef on_exception(request: Request, response: Response, exc: Exception):\n    response.text = str(exc)\n\n\napp.add_exception_handler(on_exception)\n```\n\n---\n\n## Custom Response\nBizAPI allows returning different types of responses:\n```python\n@app.route('/json')\ndef json(request: Request, response: Response):\n    response.json = {'message': 'Hello, World'}\n```\n```python\n@app.route('/text')\ndef text(request: Request, response: Response):\n    response.text = \"Hello World\"\n```\n```python\n@app.route('/html')\ndef html(request: Request, response: Response):\n    response.html = \"\u003ch1\u003eHello, World\u003c/h1\u003e\"\n```\n\n---\n\n## Middleware\nYou can add middleware to process requests and responses:\n```python\nfrom bizapi.middleware import Middleware\n\nclass CustomMiddleware(Middleware):\n    def request(self, request: Request):\n        print(f\"Request received: {request.path}\")\n\n    def response(self, request: Request, response: Response):\n        print(f\"Response sent for: {request.path}\")\n\napp.add_middleware(CustomMiddleware)\n\n```\n\n---\n\n**License**  \nThis project is licensed under the [MIT License](https://opensource.org/license/mit).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferinshek%2Fbizapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferinshek%2Fbizapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferinshek%2Fbizapi/lists"}