Tinyapi is a tiny python web framework for quick API development. Its fast, and very easy to get started.
It's not a competitor of other frameworks like Django, Flask or FastAPI.
The sole purpose of creating it is for learning and gaining better insights about
how a backend technology works.
It is created with the help of webob.
Webob is a library which provides objects for HTTP requests and responses.
Note:- tiny-api also supports template rendering however it is not recommended.
It is better suited for client-server architectured applications. Hence, it's better to use it with something like React js or Angualr.
Open your terminal and enter:-
$ pip3 install tiny-api
Github :-
$ git clone https://github.com/Kaushal-Dhungel/tiny-api.git
Its really easy to get startted with tiny-api. Copy the code below and save it as app.py :-
from tiny_api import Tinyapi
from tiny_api.Responses import JsonResponse
from tiny_api.Status import HTTP_200_OK
app = Tinyapi()
@app.route('/home')
def home(request):
return JsonResponse({'data':'hello world'},HTTP_200_OK)
Now open the terminal and run :-
$ gunicorn app:app --reload
That's it. Now visit 127.0.0.1:8000/home on your browser and you will see :-
{'data':'hello world'}
Congratulations !!