` approach to load initial HTML,
+ // e.g: ui.Load("data:text/html," + url.PathEscape(html))
+
+ ln, err := net.Listen("tcp", "127.0.0.1:0")
+ if err != nil {
+ log.Fatal(err)
+ }
+ defer ln.Close()
+ go http.Serve(ln, http.FileServer(http.FS(fs)))
+ ui.Load(fmt.Sprintf("http://%s/www", ln.Addr()))
+
+ // You may use console.log to debug your JS code, it will be printed via
+ // log.Println(). Also exceptions are printed in a similar manner.
+ ui.Eval(`
+ console.log("Hello, world!");
+ console.log('Multiple values:', [1, false, {"x":5}]);
+ `)
+
+ // Wait until the interrupt signal arrives or browser window is closed
+ sigc := make(chan os.Signal)
+ signal.Notify(sigc, os.Interrupt)
+ select {
+ case <-sigc:
+ case <-ui.Done():
+ }
+
+ log.Println("exiting...")
+}
diff --git a/2021/7-25-Lorca/examples/counter/www/favicon.png b/2021/7-25-Lorca/examples/counter/www/favicon.png
new file mode 100644
index 0000000..82ff856
Binary files /dev/null and b/2021/7-25-Lorca/examples/counter/www/favicon.png differ
diff --git a/2021/7-25-Lorca/examples/counter/www/index.html b/2021/7-25-Lorca/examples/counter/www/index.html
new file mode 100644
index 0000000..467b8dc
--- /dev/null
+++ b/2021/7-25-Lorca/examples/counter/www/index.html
@@ -0,0 +1,51 @@
+
+
+
+ Counter
+
+
+
+
+
+
+
+
+
+
+
diff --git a/2021/7-25-Lorca/examples/hello/hello_win10 b/2021/7-25-Lorca/examples/hello/hello_win10
new file mode 100755
index 0000000..264e467
Binary files /dev/null and b/2021/7-25-Lorca/examples/hello/hello_win10 differ
diff --git a/2021/7-25-Lorca/examples/hello/main.go b/2021/7-25-Lorca/examples/hello/main.go
new file mode 100644
index 0000000..9594465
--- /dev/null
+++ b/2021/7-25-Lorca/examples/hello/main.go
@@ -0,0 +1,40 @@
+/**
+* @File : main.go
+* @Time : 2021/07/22 14:20:03
+* @Author : GH
+* @Desc :
+
+编译windows
+CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -v -o hello_win10 main.go
+
+*/
+
+
+package main
+
+import (
+ "log"
+ "net/url"
+
+ "github.com/zserge/lorca"
+)
+
+func main() {
+ // Create UI with basic HTML passed via data URI
+ ui, err := lorca.New("data:text/html,"+url.PathEscape(`
+
+ Hello
+ Hello, world!
+
+ `), "", 480, 320)
+ if err != nil {
+ log.Fatal(err)
+ }
+ defer ui.Close()
+
+ ui.Bind("addUp", func(a, b int) int { return a + b })
+ // let x=await addUp(34534342,23748374823)
+
+ // Wait until UI window is closed
+ <-ui.Done()
+}
diff --git a/2021/7-25-Lorca/examples/hello/main_macOS b/2021/7-25-Lorca/examples/hello/main_macOS
new file mode 100755
index 0000000..3601a8e
Binary files /dev/null and b/2021/7-25-Lorca/examples/hello/main_macOS differ
diff --git a/2021/7-25-Lorca/examples/stopwatch/main.go b/2021/7-25-Lorca/examples/stopwatch/main.go
new file mode 100644
index 0000000..04f3548
--- /dev/null
+++ b/2021/7-25-Lorca/examples/stopwatch/main.go
@@ -0,0 +1,69 @@
+/**
+* @File : main.go
+* @Time : 2021/07/22 14:58:21
+* @Author : GH
+* @Desc :
+
+编译windows
+CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -v -o stopwatch_win10 main.go
+
+*/
+
+
+package main
+
+import (
+ "fmt"
+ "log"
+ "net/url"
+ "sync/atomic"
+ "time"
+
+ "github.com/zserge/lorca"
+)
+
+func main() {
+ ui, err := lorca.New("计时器", "", 480, 320)
+ if err != nil {
+ log.Fatal(err)
+ }
+ defer ui.Close()
+
+ // Data model: number of ticks
+ ticks := uint32(0)
+ // Channel to connect UI events with the background ticking goroutine
+ togglec := make(chan bool)
+ // Bind Go functions to JS
+ ui.Bind("toggle", func() { togglec <- true })
+ ui.Bind("reset", func() {
+ atomic.StoreUint32(&ticks, 0)
+ ui.Eval(`document.querySelector('.timer').innerText = '0'`)
+ ui.Eval(`console.log("reset ....")`)// 打印日志
+ })
+
+ // Load HTML after Go functions are bound to JS
+ ui.Load("data:text/html," + url.PathEscape(`
+
+
+
+
+ Reset
+
+
+ `))
+
+ // Start ticker goroutine
+ go func() {
+ t := time.NewTicker(100 * time.Millisecond)
+ for {
+ select {
+ case <-t.C: // Every 100ms increate number of ticks and update UI
+ ui.Eval(fmt.Sprintf(`document.querySelector('.timer').innerText = 0.1*%d`,
+ atomic.AddUint32(&ticks, 1)))
+ case <-togglec: // If paused - wait for another toggle event to unpause
+ <-togglec
+ }
+ }
+ }()
+ <-ui.Done()
+}
diff --git a/2021/7-25-Lorca/examples/stopwatch/main_macOS b/2021/7-25-Lorca/examples/stopwatch/main_macOS
new file mode 100755
index 0000000..e9a67ee
Binary files /dev/null and b/2021/7-25-Lorca/examples/stopwatch/main_macOS differ
diff --git a/2021/7-25-Lorca/examples/stopwatch/stopwatch_win10 b/2021/7-25-Lorca/examples/stopwatch/stopwatch_win10
new file mode 100755
index 0000000..37f1133
Binary files /dev/null and b/2021/7-25-Lorca/examples/stopwatch/stopwatch_win10 differ
diff --git a/2021/7-4-diskcache/README.md b/2021/7-4-diskcache/README.md
new file mode 100644
index 0000000..943d7bb
--- /dev/null
+++ b/2021/7-4-diskcache/README.md
@@ -0,0 +1,22 @@
+
+# diskcache本地缓存持久化
+
+- 视频 [【编程】Python : diskcache 本地缓存持久化,一行代码](https://www.bilibili.com/video/BV1dv411H77k/)
+
+- 缓存考虑
+ - Redis 数据库
+ - memcache
+
+- 临时缓存
+ - lru_cache 服务器使用
+ - from functools import lru_cache
+
+- 推荐使用
+ - [diskcache](https://pypi.org/project/diskcache/)
+
+
+- 教程
+ - 安装 https://pypi.org/project/diskcache/
+ - 教程 http://www.grantjenks.com/docs/diskcache/tutorial.html
+ - 问题 https://stackoverflow.com/questions/16463582/memoize-to-disk-python-persistent-memoization
+
diff --git a/2021/7-4-diskcache/diskcache1.py b/2021/7-4-diskcache/diskcache1.py
new file mode 100644
index 0000000..9bf7df7
--- /dev/null
+++ b/2021/7-4-diskcache/diskcache1.py
@@ -0,0 +1,33 @@
+# -*- encoding: utf-8 -*-
+'''
+@File : diskcache1.py
+@Time : 2021/07/04 12:47:38
+@Author : GH
+@Desc :
+'''
+import requests
+from functools import lru_cache
+
+from diskcache import Cache
+cache = Cache('cachedir')
+
+
+# @lru_cache() # Flask 服务器使用,才行
+@cache.memoize()
+def get_ip(a): # 需要很多计算,计算一次就可以了
+ print('不使用缓存')
+ url = 'https://httpbin.org/ip'
+ rs = requests.get(url)
+ print('get IP:', rs.text)
+
+ return rs.json()['origin']
+
+
+def main():
+ ip = get_ip(a=1)
+ print(ip)
+ pass
+
+
+if __name__ == "__main__":
+ main()
diff --git a/2021/8-1-deta-fastapi/README.md b/2021/8-1-deta-fastapi/README.md
new file mode 100644
index 0000000..ad0f9ad
--- /dev/null
+++ b/2021/8-1-deta-fastapi/README.md
@@ -0,0 +1,55 @@
+
+- 视频 ??
+
+- 文档
+ - 部署到Deta[Deploy FastAPI on Deta](https://fastapi.tiangolo.com/zh/deployment/deta/)
+ - 开始启动[Getting Started](https://docs.deta.sh/docs/micros/getting_started/)
+
+- 安装
+```bash
+(.py39) pro:~ play$ curl -fsSL https://get.deta.dev/cli.sh | sh
+########################################################################################## 100.0%
+Archive: /Users/play/.deta/bin/deta.zip
+ inflating: deta
+ inflating: ._deta
+Deta was installed successfully to /Users/play/.deta/bin/deta
+Run 'deta --help' in a new shell to get started
+```
+- 登录
+```bash
+(.py39) pro:~ play$ /Users/play/.deta/bin/deta login
+Please, log in from the web page. Waiting..
+https://web.deta.sh/cli/52934
+Logged in successfully.
+```
+- 新建
+```bash
+(.py39) pro:app play$ /Users/play/.deta/bin/deta new
+Successfully created a new micro
+{
+ "name": "app",
+ "runtime": "python3.7",
+ "endpoint": "https://zba3nl.deta.dev",
+ "visor": "enabled",
+ "http_auth": "disabled"
+}
+Adding dependencies...
+Collecting fastapi
+ Downloading https://files.pythonhosted.org/packages/52/be/2a26007dc86c51e87d70021f6c1b3442726c5918fe57d27927badf687122/fastapi-0.67.0-py3-none-any.whl (51kB)
+Collecting starlette==0.14.2
+ Downloading https://files.pythonhosted.org/packages/15/34/db1890f442a1cd3a2c761f4109a0eb4e63503218d70a8c8e97faa09a5500/starlette-0.14.2-py3-none-any.whl (60kB)
+Collecting pydantic!=1.7,!=1.7.1,!=1.7.2,!=1.7.3,!=1.8,!=1.8.1,<2.0.0,>=1.6.2
+ Downloading https://files.pythonhosted.org/packages/9f/f2/2d5425efe57f6c4e06cbe5e587c1fd16929dcf0eb90bd4d3d1e1c97d1151/pydantic-1.8.2-cp37-cp37m-manylinux2014_x86_64.whl (10.1MB)
+Collecting typing-extensions>=3.7.4.3
+ Downloading https://files.pythonhosted.org/packages/2e/35/6c4fff5ab443b57116cb1aad46421fb719bed2825664e8fe77d66d99bcbc/typing_extensions-3.10.0.0-py3-none-any.whl
+Installing collected packages: starlette, typing-extensions, pydantic, fastapi
+Successfully installed fastapi-0.67.0 pydantic-1.8.2 starlette-0.14.2 typing-extensions-3.10.0.0
+```
+- 更新
+```
+
+```
+
+## 数据库
+
+## 文件存储
\ No newline at end of file
diff --git a/2021/8-15-Marp-ppt/IMG_20210715_122251.jpg b/2021/8-15-Marp-ppt/IMG_20210715_122251.jpg
new file mode 100755
index 0000000..6dd7964
Binary files /dev/null and b/2021/8-15-Marp-ppt/IMG_20210715_122251.jpg differ
diff --git a/2021/8-15-Marp-ppt/IMG_20210806_092900.jpg b/2021/8-15-Marp-ppt/IMG_20210806_092900.jpg
new file mode 100755
index 0000000..c56c3c3
Binary files /dev/null and b/2021/8-15-Marp-ppt/IMG_20210806_092900.jpg differ
diff --git a/2021/8-15-Marp-ppt/README.MD b/2021/8-15-Marp-ppt/README.MD
new file mode 100644
index 0000000..be584bc
--- /dev/null
+++ b/2021/8-15-Marp-ppt/README.MD
@@ -0,0 +1,53 @@
+---
+marp: true
+---
+
+# Marp:用 Markdown「写」PPT 的新选择
+- Marp
+ - Markdown --> PPT
+
+---
+# 需求
+- 制作视频之前,写文案
+ - 工作量少,简单
+ - 不想写一堆代码
+ - 翻页效果,即可。
+ - 有动画更好
+- 简洁,清晰明了
+ - 不想做得花里胡哨
+- 视频 [【新技能】Marp 使用 Markdown 制作 PPT , 电脑不用安装PowerPoint](https://www.bilibili.com/video/BV17v411T7wH/)
+---
+- 参考
+ - [Marp:用 Markdown「写」PPT 的新选择](https://sspai.com/post/55718)
+ - 前往 VSCode 的网站 下载并安装 VSCode 本体,
+ - 然后在左侧的插件栏中搜索并安装 Marp for VS Code。
+ - 为了获得更好的 Markdown 编辑体验,大家不妨再安装一个叫做 Markdown All in One 的插件,然后就可以开始愉快地使用 Marp 了。
+ - 使用 Markdown 预览功能,确认无误后,再导出
+ - toggle打开或关闭特效
+ - marp: true
+ - 缺点,没有动画特效
+- Demo
+ - https://yhatt-marp-cli-example.netlify.app/#1
+ - 代码 https://github.com/yhatt/marp-cli-example
+
+# reveal.js 官网 https://revealjs.com/
+---
+编辑完成后,通过编辑器右上角的 Marp 图标按钮就可以调出 Export slide deck 命令并导出幻灯片了。Marp 插件目前支持导出 HTML 和 PDF 格式,另外可以将首页导出为 PNG 或 JPEG 格式的图片。
+
+需要注意的是,目前导出 PDF 或者图片时需要依赖 Chromium 内核的浏览器。最终的导出效果与预览时看到的相同。
+
+---
+# 1号标题123
+## 2号标题1234
+- 1 测试
+ - 2
+ - 3
+
+# reveal.js
+
+---
+
+## 2号标题 1235
+- 4 测试
+ - 2
+ - 3
\ No newline at end of file
diff --git a/2021/8-15-Marp-ppt/README.html b/2021/8-15-Marp-ppt/README.html
new file mode 100644
index 0000000..1ab153d
--- /dev/null
+++ b/2021/8-15-Marp-ppt/README.html
@@ -0,0 +1,98 @@
+Previous slide Next slide Toggle fullscreen Open presenter view
+ Marp:用 Markdown「写」PPT 的新选择
+
+
+
+需求
+
+制作视频之前,写文案
+
+工作量少,简单
+
+
+翻页效果,即可。
+
+
+
+
+简洁,清晰明了
+
+
+
+
+
+
+参考
+
+Marp:用 Markdown「写」PPT 的新选择
+
+前往 VSCode 的网站 下载并安装 VSCode 本体,
+然后在左侧的插件栏中搜索并安装 Marp for VS Code。
+为了获得更好的 Markdown 编辑体验,大家不妨再安装一个叫做 Markdown All in One 的插件,然后就可以开始愉快地使用 Marp 了。
+
+
+使用 Markdown 预览功能,确认无误后,再导出
+toggle打开或关闭特效
+
+
+缺点,没有动画特效
+
+
+
+reveal.js
+
+
+编辑完成后,通过编辑器右上角的 Marp 图标按钮就可以调出 Export slide deck 命令并导出幻灯片了。Marp 插件目前支持导出 HTML 和 PDF 格式,另外可以将首页导出为 PNG 或 JPEG 格式的图片。
+需要注意的是,目前导出 PDF 或者图片时需要依赖 Chromium 内核的浏览器。最终的导出效果与预览时看到的相同。
+
+
+1号标题123
+2号标题1234
+
+reveal.js
+
+
+
\ No newline at end of file
diff --git "a/2021/8-15-Marp-ppt/demo-\345\256\214\346\210\220.html" "b/2021/8-15-Marp-ppt/demo-\345\256\214\346\210\220.html"
new file mode 100644
index 0000000..ac5d26c
--- /dev/null
+++ "b/2021/8-15-Marp-ppt/demo-\345\256\214\346\210\220.html"
@@ -0,0 +1,127 @@
+Previous slide Next slide Toggle fullscreen Open presenter view
+
+上午
+
+
+9:00
+
+
+
+9:15
+
+
+
+9:30
+
+开始工作
+和产品经理沟通,battle 打嘴仗
+
+
+
+10:00
+
+
+
+11:00
+
+
+
+
+
+中午
+
+11:55
+
+
+12:30
+
+
+13:00-->14:00
+
+
+
+
+
+下午
+
+14:00
+
+
+16:00
+
+
+18:00
+
+
+
+
+
+晚上
+
+19:00
+
+
+20:45
+
+
+21:00
+
+
+
+
+
\ No newline at end of file
diff --git "a/2021/8-15-Marp-ppt/demo-\345\256\214\346\210\220.md" "b/2021/8-15-Marp-ppt/demo-\345\256\214\346\210\220.md"
new file mode 100644
index 0000000..33fd298
--- /dev/null
+++ "b/2021/8-15-Marp-ppt/demo-\345\256\214\346\210\220.md"
@@ -0,0 +1,67 @@
+---
+marp: true
+---
+
+# 程序员的996,每天工作安排
+
+---
+
+
+# 上午
+- 9:00
+ - 上班打卡,企业微信
+ - 开早会
+- 9:15
+ - 敏捷开发管理系统
+ - 领取工作内容
+---
+- 9:30
+ - 开始工作
+ - 和产品经理沟通,battle 打嘴仗
+
+---
+
+- 10:00
+ - 摸鱼时间
+ - 上厕所
+ - 刷微博
+- 11:00
+ - 摸鱼时间
+ - 上厕所
+ - 刷微博
+---
+
+## 中午
+- 11:55
+ - 提前去食堂,避免排队
+ 
+---
+
+- 12:30
+ - 吃完
+ - 回公司吹牛
+- 13:00-->14:00
+ - 叹空调,睡午觉
+---
+
+# 下午
+- 14:00
+ - 闹钟吵醒,洗脸上班
+- 16:00
+ - 非常困倦
+ - 摸鱼
+- 18:00
+ - 准点离开公司
+ - 吃饭
+ - 散步
+---
+
+# 晚上
+- 19:00
+ - 加班
+- 20:45
+ - 敏捷开发管理系统
+ - 提交工作进度
+- 21:00
+ - 下班打卡,企业微信
+ - 准点离开公司
\ No newline at end of file
diff --git "a/2021/8-15-Marp-ppt/demo-\345\256\214\346\210\2202.html" "b/2021/8-15-Marp-ppt/demo-\345\256\214\346\210\2202.html"
new file mode 100644
index 0000000..1fe4d57
--- /dev/null
+++ "b/2021/8-15-Marp-ppt/demo-\345\256\214\346\210\2202.html"
@@ -0,0 +1,127 @@
+Previous slide Next slide Toggle fullscreen Open presenter view
+
+上午
+
+
+9:00
+
+
+
+9:15
+
+
+
+9:30
+
+开始工作
+和产品经理沟通,battle 打嘴仗
+
+
+
+10:00
+
+
+
+11:00
+
+
+
+
+
+中午
+
+11:55
+
+
+12:30
+
+
+13:00-->14:00
+
+
+
+
+
+下午
+
+14:00
+
+
+16:00
+
+
+18:00
+
+
+
+
+
+晚上
+
+19:00
+
+
+20:45
+
+
+21:00
+
+
+
+
+
\ No newline at end of file
diff --git "a/2021/8-15-Marp-ppt/demo-\345\256\214\346\210\2203.html" "b/2021/8-15-Marp-ppt/demo-\345\256\214\346\210\2203.html"
new file mode 100644
index 0000000..babcabe
--- /dev/null
+++ "b/2021/8-15-Marp-ppt/demo-\345\256\214\346\210\2203.html"
@@ -0,0 +1,127 @@
+Previous slide Next slide Toggle fullscreen Open presenter view
+
+上午
+
+
+9:00
+
+
+
+9:15
+
+
+
+9:30
+
+开始工作
+和产品经理沟通,battle 打嘴仗
+
+
+
+10:00
+
+
+
+11:00
+
+
+
+
+
+中午
+
+11:55
+
+
+12:30
+
+
+13:00-->14:00
+
+
+
+
+
+下午
+
+14:00
+
+
+16:00
+
+
+18:00
+
+
+
+
+
+晚上
+
+19:00
+
+
+20:45
+
+
+21:00
+
+
+
+
+
\ No newline at end of file
diff --git "a/2021/8-15-Marp-ppt/demo-\345\256\214\346\210\2204.html" "b/2021/8-15-Marp-ppt/demo-\345\256\214\346\210\2204.html"
new file mode 100644
index 0000000..5d93123
--- /dev/null
+++ "b/2021/8-15-Marp-ppt/demo-\345\256\214\346\210\2204.html"
@@ -0,0 +1,127 @@
+Previous slide Next slide Toggle fullscreen Open presenter view
+
+上午
+
+
+9:00
+
+
+
+9:15
+
+
+
+9:30
+
+开始工作
+和产品经理沟通,battle 打嘴仗
+
+
+
+10:00
+
+
+
+11:00
+
+
+
+
+
+ 中午
+
+11:55
+
+
+12:30
+
+
+13:00-->14:00
+
+
+
+
+
+ 下午
+
+14:00
+
+
+16:00
+
+
+18:00
+
+
+
+
+
+ 晚上
+
+19:00
+
+
+20:45
+
+
+21:00
+
+
+
+
+
\ No newline at end of file
diff --git "a/2021/8-15-Marp-ppt/demo-\345\256\214\346\210\2205.html" "b/2021/8-15-Marp-ppt/demo-\345\256\214\346\210\2205.html"
new file mode 100644
index 0000000..a5c2f33
--- /dev/null
+++ "b/2021/8-15-Marp-ppt/demo-\345\256\214\346\210\2205.html"
@@ -0,0 +1,136 @@
+Previous slide Next slide Toggle fullscreen Open presenter view
+
+
+
+9:30
+
+开始工作
+和产品经理沟通,battle 打嘴仗
+
+
+
+
+
+
+
+中午
+
+11:55
+
+提前去食堂,避免排队
+
+
+
+
+
+
+
+12:30
+
+
+13:00-->14:00
+
+
+
+
+
+下午
+
+14:00
+
+
+16:00
+
+
+18:00
+
+
+
+
+
+晚上
+
+19:00
+
+
+20:45
+
+
+21:00
+
+
+
+
+
\ No newline at end of file
diff --git "a/2021/8-15-Marp-ppt/demo-\345\256\214\346\210\2206.html" "b/2021/8-15-Marp-ppt/demo-\345\256\214\346\210\2206.html"
new file mode 100644
index 0000000..95a00c5
--- /dev/null
+++ "b/2021/8-15-Marp-ppt/demo-\345\256\214\346\210\2206.html"
@@ -0,0 +1,136 @@
+Previous slide Next slide Toggle fullscreen Open presenter view
+
+
+
+9:30
+
+开始工作
+和产品经理沟通,battle 打嘴仗
+
+
+
+
+
+
+
+中午
+
+11:55
+
+提前去食堂,避免排队
+
+
+
+
+
+
+
+12:30
+
+
+13:00-->14:00
+
+
+
+
+
+下午
+
+14:00
+
+
+16:00
+
+
+18:00
+
+
+
+
+
+晚上
+
+19:00
+
+
+20:45
+
+
+21:00
+
+
+
+
+
\ No newline at end of file
diff --git a/2021/8-15-Marp-ppt/demo.md b/2021/8-15-Marp-ppt/demo.md
new file mode 100644
index 0000000..a3af722
--- /dev/null
+++ b/2021/8-15-Marp-ppt/demo.md
@@ -0,0 +1,51 @@
+
+# 程序员的996,每天工作安排
+## 上午
+- 9:00
+ - 上班打卡,企业微信
+ - 开早会
+- 9:15
+ - 敏捷开发管理系统
+ - 领取工作内容
+- 9:30
+ - 开始工作
+ - 和产品经理沟通,battle 打嘴仗
+
+- 10:00
+ - 摸鱼时间
+ - 上厕所
+ - 刷微博
+- 11:00
+ - 摸鱼时间
+ - 上厕所
+ - 刷微博
+
+## 中午
+- 11:55
+ - 提前去食堂,避免排队
+- 12:20
+ - 吃完
+ - 回公司吹牛
+- 13:00-->14:00
+ - 叹空调,睡午觉
+
+## 下午
+- 14:00
+ - 闹钟吵醒,洗脸上班
+- 16:00
+ - 非常困倦
+ - 摸鱼
+- 18:00
+ - 准点离开公司
+ - 吃饭
+ - 散步
+
+## 晚上
+- 19:00
+ - 加班
+- 20:45
+ - 敏捷开发管理系统
+ - 提交工作进度
+- 21:00
+ - 下班打卡,企业微信
+ - 准点离开公司
\ No newline at end of file
diff --git a/2021/9-3-Deta-Base/BaseDemo/config.py b/2021/9-3-Deta-Base/BaseDemo/config.py
new file mode 100644
index 0000000..1a6f620
--- /dev/null
+++ b/2021/9-3-Deta-Base/BaseDemo/config.py
@@ -0,0 +1,9 @@
+# -*- encoding: utf-8 -*-
+'''
+@File : config.py
+@Time : 2021/09/03 09:47:46
+@Author : GH
+@Desc :
+'''
+
+project_key = "xxx"
diff --git a/2021/9-3-Deta-Base/BaseDemo/main.py b/2021/9-3-Deta-Base/BaseDemo/main.py
new file mode 100644
index 0000000..331d816
--- /dev/null
+++ b/2021/9-3-Deta-Base/BaseDemo/main.py
@@ -0,0 +1,64 @@
+# -*- encoding: utf-8 -*-
+'''
+@File : main.py
+@Time : 2021/08/01 16:26:39
+@Author : GH
+@Desc :
+
+执行
+uvicorn main:app
+
+'''
+from typing import Optional
+from fastapi.params import Body
+from pydantic import BaseModel
+from fastapi import FastAPI
+from deta import Deta
+from config import project_key
+
+deta = Deta(project_key)
+db = deta.Base("baseItem")
+
+app = FastAPI()
+
+
+class Item(BaseModel):
+ key: Optional[str] = None
+ name: Optional[str] = None
+ age: Optional[int] = None
+
+
+@app.get("/")
+def read_root():
+ return {"Hello": "World, great day! 数据库NoSQL"}
+
+
+@app.put("/items/")
+def put_item(item: Item):
+ print("item_id:", item)
+ # TODO 存入数据库
+ del item.key
+ rs = db.put(item.dict())
+ return {"item": item, 'put': rs}
+
+
+@app.get("/items/{key}")
+def read_item(key: str): # 1orwum5g2grm
+ print("item_id:", key)
+ rs = db.get(key)
+ return {"item": rs}
+
+
+@app.put("/items/update")
+def update_item(item: Item):
+
+ # rs = db.update({'age': item.age, 'name': item.name}, key=item.key)
+ rs = db.put(item.dict()) # 直接更新
+
+ return {"update": rs}
+
+
+@app.delete("/items/{key}")
+def delete_item(key: str):
+ rs = db.delete(key)
+ return {"delete": rs}
diff --git a/2021/9-3-Deta-Base/BaseDemo/requirements.txt b/2021/9-3-Deta-Base/BaseDemo/requirements.txt
new file mode 100644
index 0000000..6b0b939
--- /dev/null
+++ b/2021/9-3-Deta-Base/BaseDemo/requirements.txt
@@ -0,0 +1 @@
+fastapi
diff --git a/2021/9-3-Deta-Base/README.md b/2021/9-3-Deta-Base/README.md
new file mode 100644
index 0000000..ad5dc79
--- /dev/null
+++ b/2021/9-3-Deta-Base/README.md
@@ -0,0 +1,10 @@
+
+
+
+## Deta.sh 免费数据库NoSQL : Base
+
+
+- 文档
+ - https://docs.deta.sh/docs/base/sdk/
+
+- 视频 ?
\ No newline at end of file