Tiny Web Application Framework #9571
Replies: 4 comments 5 replies
-
Thanks! This looks very promising. I am looking to develop a product that is microcontroller based and presents a REST API using HTTPS. I will follow this with interest thank you |
Beta Was this translation helpful? Give feedback.
-
Are you aware of microdot? Not to discourage you, but it's also inspired by Flask and has a near-identical interface to what you're proposing. It's also quite mature and, despite it's small size, has some rather powerful features like async support and templates. |
Beta Was this translation helpful? Give feedback.
-
I've got it set up to run sync or asych and made some other improvements. I think it's pretty usable for slapping an API on top of a project. For example, here's the code for a nodemcu (8266) and DHT22 sensor with an API provided by the web framework.
This is my first "big" MicroPython project, so any feedback is appreciated. |
Beta Was this translation helpful? Give feedback.
-
Looks nice! Sent a PR for Awesome MicroPython 👍🏻 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm putting together a web framework similar in spirit to Python Flask. You can find the code on here on GitHub Here's an example that may look familiar if you've used Flask:
Point your browser to your micro-controller's IP address and see the magic.
Obviously, it's going to be very light on functionality to fit on a micro-controller. But, I think it's a nice step up from the typical web server example code.
My plan is to get it to the point where it's suitable for building a REST API component for micro-controller projects. (Like controlling one of several GPIOs by sending a POST or PUT to a particular URL path.)
Currently, it can do GET requests like this:
So if you wanted to do something like reading temperature, humidity and barometric pressure from a BME280 sensor using HTTP URLs in the format of /temperature/celsius or /pressure/millibars, it should be suitable for that.
Still need some work to handle POST, PUT, etc. But, if you like Flask, and you like MicroPython too, this might be the project for you. Try it out and see.
Beta Was this translation helpful? Give feedback.
All reactions