A wrapper for Flask’s native routing as a form of template. Routes will be defined as objects to easily define domains.
# Inside some route object
from froi import Froi
class SomeRoute(Froi):
def __init__(self, app):
super().__init__(app, 'SomeRoute', '/some_route')
def install(self):
# define a get route on base
self.setget().route(view_func=sample_fxn_1)
# define a post
self.setpost().route('/do_something', view_func=sample_fxn_2)
# define a put
self.setput().route('/edit_something', view_func=sample_fxn_3)
# define a delete
self.setdelete().route('/delete_something', view_func=sample_fxn_4)
# Inside your server handler
from flask import Flask
from some_route import SomeRoute
app = Flask(config.APP_NAME)
SomeRoute(app).install()
app.run()
If you want a RESTful pattern to handle the routes, you can omit defining the install function.
from froi import Froi
class SomeRoute(Froi):
def __init__(self, app):
super().__init__(app, 'SomeRoute', '/some_route')
def get(self):
... do something
def post(self):
... do something
This will automatically create the defined GET, POST, PUT, and DELETE endpoints.
Release files for froi 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| froi-0.2.2.tar.gz | 3.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| froi-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:12.1 kB
Release files / froi-0.2.2.tar.gz
| Download URL | froi-0.2.2.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
74b52e01f46b36fe160f8a43ef5f387c9f98452ee39351a74d8e9e3a64e0197e
|
|
BLAKE2b-256 checksum How to use checksums |
1759c3067461ccf8f0b0a644d80192e9eeeec2d3cf104f8e7ef187fb6e454d5d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/0.12.11 CPython/2.7.15rc1 Linux/4.15.0-47-generic
|
Release files / froi-0.2.2-py3-none-any.whl
| Download URL | froi-0.2.2-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b1c0ed9627876f3af8e3288ea7d28cfc6edf8cdb1962f8dc3417a6a6197c39b2
|
|
BLAKE2b-256 checksum How to use checksums |
2e2866c75aa4ee42a9aa13543b954438298a5461d84e1c1764b3a7288f31a7b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/0.12.11 CPython/2.7.15rc1 Linux/4.15.0-47-generic
|