Build a resource board from folder files
This example stores Markdown documents and images in books/guide, then uses Webspace to provide a file list and the selected file's contents. The folder remains the source of the resources, so you do not need to copy each document into a database.
Before you begin
- You need permission to deploy schemas and APIs.
- Prepare the files to publish in
books/guide. - Set the endpoint's read permission for the intended audience.
This example serves only .md and .png files and does not scan subdirectories.
books/
└── guide/
├── getting-started.md
├── permissions.md
└── permissions.png
Configure a directory endpoint
This example uses guide as the Database identifier, assets as the table name, and content as the custom path.
- Open the schema file and select
API Build. - On the
assetstable, selectAdd static file API. - Enter
contentas the custom path. - Under
Source type, selectFolder list · file content. - Under
Choose folder, choosebooks/guide. - Add
.mdand.pngunderAllowed extensions. - Enable
Include subfoldersonly if you want to serve subdirectories. Leave it disabled for this example. - Configure the endpoint permission for the board's intended audience.
The resulting static-file contract is:
{
"mode": "directory",
"extensions": [".md", ".png"],
"recursive": false
}
mode is either file for one file or directory for a folder. extensions is the allowlist of file extensions that the endpoint can return. When recursive is false, the list contains only files directly under books/guide. Set recursive to true to serve files in subdirectories as well.
Deploy the API
- In the fixed deployment bar at the bottom of the screen, select
Deployto expand the panel upward. This first selection does not deploy the API. - Enter
guideunderDatabase identifier, then reviewStorage engine modeandClient deployment path. - Select
Deployagain inside the expanded panel. - After deployment, verify the listing at
/api/web/guide/assets/content.
Load the file list
A request to the directory endpoint without a file parameter returns a JSON listing.
{
"items": [
{
"name": "getting-started.md",
"path": "getting-started.md",
"size": 1842,
"mimeType": "text/markdown; charset=utf-8",
"modifiedAt": "2026-10-02T09:30:00Z",
"url": "/api/web/guide/assets/content?file=getting-started.md"
}
],
"total": 3,
"offset": 0,
"limit": 20
}
Use name as the list label and url when the reader selects a file. total is the full result count, while offset and limit describe the returned page.
The endpoint supports these listing queries:
| Query | Example | Purpose |
|---|---|---|
q | q=permission | Search file names. |
order | order=name:asc | Sort by name in ascending order. |
order | order=modifiedAt:desc | Show recently modified files first. |
offset | offset=20 | Skip a number of files. |
limit | limit=20 | Set the number of files to return. |
GET /api/web/guide/assets/content?q=permission&order=modifiedAt:desc&offset=0&limit=20
When limit is omitted, the endpoint returns 50 items. The maximum is 200 per request. For a larger folder, check total and increase offset to request the next page. The default order is name:asc, and q accepts up to 256 characters.
Display the selected document
Pass a relative path from the listing in the file query to retrieve that file. A relative path to a file in a subdirectory is accepted only when recursive is true.
GET /api/web/guide/assets/content?file=getting-started.md
Render .md responses with a Markdown renderer and use a .png response URL as an image source. Prefer the listing's url instead of assembling paths in the client so endpoint path changes are easier to handle.
Notes
- Add only formats you intend to publish to
extensions. This example allows.mdand.png. - You can configure up to 32 extensions.
- Hidden files and folders whose names begin with a dot (
.), and symbolic links, are not served by listing or file requests. - A relative path cannot leave the configured source folder.
- The same endpoint ACL applies to the listing and file contents. Set
login: falseexplicitly for a public endpoint; for a member endpoint, also verify the required role, level, and team conditions. - To calculate an exact
totaland sorted result, the server scans up to 2,000 files and directories. Entries later excluded as hidden or by the extension filter still count toward this limit. If the scan exceeds the limit, the server returns413and no partial listing. - After adding or editing a file, verify that
modifiedAtand the displayed content are updated. - When rendering Markdown as HTML, configure the renderer so scripts and unsafe markup are not accepted.