Open luisdemarchi opened 6 years ago
This won't work currently because the actual handler function needs to be located in app.py
. Its intended to be the one place all your route information is stored in. I'll mark this as a feature request.
@stealthycoin I'm glad that this could go into a queue for improvements, but you see, the way I did it apparently works: I imported the app object from app.py into the final file, there I did the decorator and it worked.
Now the question is: If my system has 6 "modules", in this logic, will it load my costs with AWS? I ask this, because what I understand is that each call the system will load 100% of my code and will spend more RAM, to perform a simple function lambda. No?
Can I create multiple files with routes? I would like to separate by "modules" and each module be a folder with the routes and all scripts. In the release note of 0.4 it is commented that the "chalicelib" folder has been added but does not speak if I can get the routes from the "app.pyf".
As I understand it, what I can do is create all the routes in the main file and make imports and each auxiliary function. But I do not think it would be a clean project when I hit 40 API calls.
A current test: (importing the scripts only when the correct function is requested)
app.py
I wonder if this is a viable solution:
app.py:
import chalicelib
chalicelib > init.py:
from . import users, teams
chalicelib > users > init.py:
from . import route
chalicelib > users > route.py: