Skip to main content

tomapi Python Web Framework built for learning purposes.

Project description

Routing

Routes can be defined in your main app file. You can either use a function or a class for routing.

Function routing

app = API()

@app.route('/home')
def home(request, response):
    response.text = "Hello from the HOME page"

Class based routing

@app.route("/book")
class BooksResource:
    def get(self, req, resp):
        resp.text = "Books Page"

    def post(self, req, resp):
        resp.text = "Endpoint to create a book"

Tests

To run the tests with coverage reports...

pytest test_api.py
pytest --cov=. test_api.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tomapi-0.0.1.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tomapi-0.0.1-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file tomapi-0.0.1.tar.gz.

File metadata

  • Download URL: tomapi-0.0.1.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for tomapi-0.0.1.tar.gz
Algorithm Hash digest
SHA256 701adcfc6fb514a07d33faeefa733b48750a9e380af9318177b07bc1ea955bea
MD5 1afb400a3e1af1bdbbf184846cb4c578
BLAKE2b-256 e3de780043a8658ccb22ddbaeeaec277048bbe51a754f0faed9f0d93baa1f508

See more details on using hashes here.

File details

Details for the file tomapi-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: tomapi-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for tomapi-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 59876a144b2137d3bcecf67cc2a022c5915e85e84294acf0e760ed044ca7b02f
MD5 30b66eff29c2d95fa95426a695b91491
BLAKE2b-256 24b7f458d4ed3827e42ad5fdb9ff4e6f006d4137af98b50d9bd01a2b37e96a32

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page