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.

  1. Open the schema file and select API Build.
  2. On the assets table, select Add static file API.
  3. Enter content as the custom path.
  4. Under Source type, select Folder list · file content.
  5. Under Choose folder, choose books/guide.
  6. Add .md and .png under Allowed extensions.
  7. Enable Include subfolders only if you want to serve subdirectories. Leave it disabled for this example.
  8. 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

  1. In the fixed deployment bar at the bottom of the screen, select Deploy to expand the panel upward. This first selection does not deploy the API.
  2. Enter guide under Database identifier, then review Storage engine mode and Client deployment path.
  3. Select Deploy again inside the expanded panel.
  4. 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:

QueryExamplePurpose
qq=permissionSearch file names.
orderorder=name:ascSort by name in ascending order.
orderorder=modifiedAt:descShow recently modified files first.
offsetoffset=20Skip a number of files.
limitlimit=20Set 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 .md and .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: false explicitly for a public endpoint; for a member endpoint, also verify the required role, level, and team conditions.
  • To calculate an exact total and 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 returns 413 and no partial listing.
  • After adding or editing a file, verify that modifiedAt and the displayed content are updated.
  • When rendering Markdown as HTML, configure the renderer so scripts and unsafe markup are not accepted.