微型Web应用程序框架Featherweb

MicroPython相关代码、库、软件、工具
回复
头像
shaoziyang
帖子: 3917
注册时间: 2019年 10月 21日 13:48

微型Web应用程序框架Featherweb

#1

帖子 shaoziyang »

Featherweb是一个适用于MicroPython和esp8266的精简型Web应用程序框架,只需要很少的RAM和资源就可以运行。


Example

代码: 全选

import featherweb
import gc

app = featherweb.FeatherWeb()

@app.route('/hello')
def Hello(request):
    """ Say Jello! """
    request.send("Jello!")

@app.route('/example.py')
def ExamplePy(request):
    """ Serve a binary file. """
    request.sendfile('/example.py')

def TimeoutCB():
    """ I'm bored.  What else needs to be done... """
    print("We came up for air.  May as well pick up the trash...")
    gc.collect()
    return True

app.run(callback=TimeoutCB)
 

dukeduck
帖子: 29
注册时间: 2020年 4月 25日 16:19

Re: 微型Web应用程序框架Featherweb

#2

帖子 dukeduck »

我之前几个项目用了MicroWebSrv,也很好用,写起来跟Flask差不多

https://github.com/jczic/MicroWebSrv

现在更新到MicroWebSrv2,好像是使用了uasyncio支持异步

https://github.com/jczic/MicroWebSrv2

头像
shaoziyang
帖子: 3917
注册时间: 2019年 10月 21日 13:48

Re: 微型Web应用程序框架Featherweb

#3

帖子 shaoziyang »

MicroWebSrv也挺不错的

回复

  • 随机主题
    回复总数
    阅读次数
    最新文章