flask-fs-router


Nameflask-fs-router JSON
Version 1.1.3 PyPI version JSON
download
home_pagehttps://github.com/JarriqTheTechie/flask_fs_router
SummaryStraightforward file-based routing extension for Flask. Introduces the concepts of pages to Flask.
upload_time2022-12-12 13:32:55
maintainer
docs_urlNone
authorJarriq Rolle
requires_python
licenseMIT license
keywords python development flask
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">
 <h1>FlaskFSRouter</h1>
   <a href="https://pypi.org/project/flask-fs-router"><img src="https://img.shields.io/pypi/dm/flask_fs_router?color=goldenrod&logo=flask_fs_router&style=plastic" /></a>
 </div>

<br>
<br>

Straightforward file-based routing extension for Flask. Introduces the concepts of pages to Flask. 

<br>

# Getting Started
`pip install flask_fs_router`

<br>
Initialize the extension.

```
from flask import Flask
from flask_fs_router import FlaskFSRouter

app = Flask(__name__)
FlaskFSRouter(app)
```

<br>
 
Pages are python files with a **default** function defined. These pages are stored in the `/pages` directory of your project, it is automatically available as a route based on its filename. 


Create an example index route.

`pages/index.py`

```
def default():
    return "Home page"
```


# Conventions


### Index Pages
The index file of any folder is the name of that folder. 


```
pages/ecommerce/index.py              ->         oursite.com/ecommerce     |  GET
pages/products/index.py               ->         oursite.com/products      |  GET
```


### Static Routes

```


pages/index.py              ->        oursite.com/          |  GET
pages/about.py              ->        oursite.com/about     |  GET
pages/about/index.py        ->        oursite.com/about     |  GET
pages/about/me.py           ->        oursite.com/about/me  |  GET
pages/posts/1.py            ->        oursite.com/posts/1   |  GET
pages/posts/[post_id].py    ->        oursite.com/posts/<post_id>  |  GET
```

### Request Methods
By default, pages map to **GET** requests. To change this behavior, define request methods within the file name using parentheses.

```
Example: Request methods

pages/posts/create_post(post).py            ->        oursite.com/posts/create-post  |  POST
```

# Github Page
[https://github.com/JarriqTheTechie/flask_fs_router
](https://github.com/JarriqTheTechie/flask_fs_router)
# Contributing
We love the idea of a community. We'll be putting together a contribution guide in the near future.

# License

flask_fs_router is available as open source under the terms of the MIT License http://opensource.org/licenses/MIT


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/JarriqTheTechie/flask_fs_router",
    "name": "flask-fs-router",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "Python,Development,Flask",
    "author": "Jarriq Rolle",
    "author_email": "jrolle@bnbbahamas.com",
    "download_url": "https://files.pythonhosted.org/packages/4f/ce/dba824e95e147994548dbbdc4e5c8f152c58d42d9b04efd5511d62a4d4f3/flask-fs-router-1.1.3.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n <h1>FlaskFSRouter</h1>\n   <a href=\"https://pypi.org/project/flask-fs-router\"><img src=\"https://img.shields.io/pypi/dm/flask_fs_router?color=goldenrod&logo=flask_fs_router&style=plastic\" /></a>\n </div>\n\n<br>\n<br>\n\nStraightforward file-based routing extension for Flask. Introduces the concepts of pages to Flask. \n\n<br>\n\n# Getting Started\n`pip install flask_fs_router`\n\n<br>\nInitialize the extension.\n\n```\nfrom flask import Flask\nfrom flask_fs_router import FlaskFSRouter\n\napp = Flask(__name__)\nFlaskFSRouter(app)\n```\n\n<br>\n \nPages are python files with a **default** function defined. These pages are stored in the `/pages` directory of your project, it is automatically available as a route based on its filename. \n\n\nCreate an example index route.\n\n`pages/index.py`\n\n```\ndef default():\n    return \"Home page\"\n```\n\n\n# Conventions\n\n\n### Index Pages\nThe index file of any folder is the name of that folder. \n\n\n```\npages/ecommerce/index.py              ->         oursite.com/ecommerce     |  GET\npages/products/index.py               ->         oursite.com/products      |  GET\n```\n\n\n### Static Routes\n\n```\n\n\npages/index.py              ->        oursite.com/          |  GET\npages/about.py              ->        oursite.com/about     |  GET\npages/about/index.py        ->        oursite.com/about     |  GET\npages/about/me.py           ->        oursite.com/about/me  |  GET\npages/posts/1.py            ->        oursite.com/posts/1   |  GET\npages/posts/[post_id].py    ->        oursite.com/posts/<post_id>  |  GET\n```\n\n### Request Methods\nBy default, pages map to **GET** requests. To change this behavior, define request methods within the file name using parentheses.\n\n```\nExample: Request methods\n\npages/posts/create_post(post).py            ->        oursite.com/posts/create-post  |  POST\n```\n\n# Github Page\n[https://github.com/JarriqTheTechie/flask_fs_router\n](https://github.com/JarriqTheTechie/flask_fs_router)\n# Contributing\nWe love the idea of a community. We'll be putting together a contribution guide in the near future.\n\n# License\n\nflask_fs_router is available as open source under the terms of the MIT License http://opensource.org/licenses/MIT\n\n",
    "bugtrack_url": null,
    "license": "MIT license",
    "summary": "Straightforward file-based routing extension for Flask. Introduces the concepts of pages to Flask.",
    "version": "1.1.3",
    "split_keywords": [
        "python",
        "development",
        "flask"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "412a6d4390173889ed531823f4ac3f2a",
                "sha256": "722e5e87b908cb957c2dbd0536d6dd0c467e2fa74929b982cd25d4f507df4ca7"
            },
            "downloads": -1,
            "filename": "flask_fs_router-1.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "412a6d4390173889ed531823f4ac3f2a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 4167,
            "upload_time": "2022-12-12T13:32:54",
            "upload_time_iso_8601": "2022-12-12T13:32:54.396183Z",
            "url": "https://files.pythonhosted.org/packages/b6/7b/bbdb6072dabfdb0b31fe858f733308a78d5f194a9d4c8abddf3328240dc0/flask_fs_router-1.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "61114a295efbe0e2d5d547890ae0dddd",
                "sha256": "4ceac8f45b099d50aa0b93acdc33e59c67569a64b5f1ca5da640d2981de12090"
            },
            "downloads": -1,
            "filename": "flask-fs-router-1.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "61114a295efbe0e2d5d547890ae0dddd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4862,
            "upload_time": "2022-12-12T13:32:55",
            "upload_time_iso_8601": "2022-12-12T13:32:55.655473Z",
            "url": "https://files.pythonhosted.org/packages/4f/ce/dba824e95e147994548dbbdc4e5c8f152c58d42d9b04efd5511d62a4d4f3/flask-fs-router-1.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-12 13:32:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "JarriqTheTechie",
    "github_project": "flask_fs_router",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "flask-fs-router"
}
        
Elapsed time: 0.02889s