aboutsummaryrefslogtreecommitdiffstats
path: root/tiddlers/files API demo.tid
blob: dce6e46bd4530302a709a81177349d9c68e580d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
created: 20260726073547121
modified: 20260726085801292
tags: tiddlywiki
title: files API demo
type: text/vnd.tiddlywiki

\procedure store-file-list()
<$action-setfield
  $tiddler="$:/temp/files-list"
  text=<<data>>
  type="application/json"
/>
\end

<$button>
  <$action-sendmessage
    $message="tm-http-request"
    url="./api/files"
    method="GET"
    oncompletion=<<store-file-list>>
  />
  刷新文件列表
</$button>

<pre><$text text={{$:/temp/files-list}}/></pre>

[img[./files/photo_2026-07-26_11-10-12.jpg]]


```caddyfile
example.com {
    encode zstd gzip

    @api path /api/*
    reverse_proxy @api localhost:3000

    header {
        X-Content-Type-Options nosniff
    }
}


```json5
{
  // 支持注释
  unquoted: 'value',
  hexadecimal: 0xFF,
  infinity: Infinity,
  trailingComma: true,
}