An automatic code API generator for Flask and JS.
Project description
Sharp
Sharp is an automatic API generation library for Python Flask and JavaScript. You just define functions in the backend, and they are magically available to you on the frontend, with type checking built-in.
Example
Server-side code,
app = Flask(__name__)
sharp = Sharp(app)
@sharp.function()
def add(a: int, b: int):
return {
"result": a + b,
}
And magically on your front-end,
const result = await API.add(4, 3);
Sharp can be combined with a modern frontend framework and any web asset bundler, the code-gen is emmitted to a standalone JavaScript file,
sharp.generate("src/js/sharp.gen.js")
All Sharp messages are in plain JSON, producing human-readable messages and API routes.
For a more fully fledged example, please see the example/
directory.
License
Copyright (c) 2020 Shreyas Kapur. Released under MIT License.
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
Built Distribution
Hashes for Flask_Sharp-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2fe98fbc3f010266f5ca2d37176a065635ea5312119e63ba69e9a5c30fd9cf0 |
|
MD5 | ab6af4731d4cc51104d9deb3d534b4a1 |
|
BLAKE2b-256 | 355e59318d7bf6f5af5c84eed7f2d8519919007fad7e06abafa3ab4c30161820 |