AutoAPI | GitHub
No more boring and hardcoding of API for your model/application.
- With AutoAPI, you don’t have to hardcode the endpoints you can simply define them in the
config.yamlfile, run the application, and boom! your API is up and running.
-
We can include a environment that we need our application to be deployed in.
environment: dev # May be anything prod/staging dev: # Use the required env here parameters here: ....
-
We can select a framework(as of now only
Flaskwas integrated).flask: host: "0.0.0.0" port: 5000 debug: true
-
As of now I included adding Endpoints in the
config.yamlfile with supported nested endpoints. -
Two types of responses were added at this point.
raw- Some random text you want to appear or may be html for the frontend. In this case thevaluemay be anything in strings or a html file.python- Execute a python function. Need to specify two things.value- Source of the python filefunction- Function we need to call when triggered.
endpoints: - path: "/books" routes: - path: "/" method: ["GET"] response: type: "raw" value: "Welocome to AutoAPI" - path: "/add" method: ["POST"] response: type: "python" value: "tests.book_api" function: "post_book"
-
Added logging system - Things you need to specify for adding logging
- You can the logger from
autoapi.logger.get_loggerfunction to add into your code.
logging: enabled: true # false by default logfile: "access" # Name of the file level: "INFO" # Type of log
- You can the logger from
-
Added reload of YAML - Reload of application when new things are added without any interruption.
debounce_seconds- reload at everydebounce_seconds
reload: enabled: true # false by default debounce_seconds: 2 # reload time(sec)
-
Added Containerization - Now we can containerize our application in one setup.
- This will automatically extract the port and other stuff (can be done later).
- Will try to give it an another
yamlfile for docker and setup the things without any use of theDockerfilefrom the user. - Need to return some output after containerizing the application.
autoapi dockerize --dockerfile=Dockerfile # Source file
Currently, I’m still working on it, so it might take some time before the project is ready for cloud deployment. For now, I’m focusing on local deployment.