serve
Serves a locally built custom front-end over HTTP while proxying API calls to a remote workspace. The fastest way to iterate on a custom UI without re-uploading after every change.
The folder you point at must look like a compiled Mosaik.FrontEnd bundle — the CLI checks for a mosaik.app marker file in the root.
Syntax
Usage: curiosity-cli serve --server <url> [--path <dir>] [--name <name>] [--port <port>] [options]
curiosity-cli serve \
--server https://my-workspace.example.com/ \
--path ./MyApp/bin/Debug/netstandard2.0/h5/
If --path is omitted, the current working directory is used. If --server is omitted, the CLI tries to guess the workspace URL by scanning the *.js files in the bundle for a serverURL / apiURL variable — don't rely on this in real workflows, pass --server explicitly.
Options
| Option | Description |
|---|---|
--server |
Workspace URL to proxy API calls to. Strongly recommended to set explicitly. Alias -s. Default: guessed from the bundle. |
--path |
Local path to the compiled h5/ folder. Alias -p. Default pwd. |
--name |
App name shown in the dev UI's nav bar. Default Mosaik. |
--ignore-certificate-errors |
Disable TLS validation against the proxied workspace. Dev only. Default false. |
--port |
Local TCP port to bind. Default 5000. |
--cert-file |
Path to a certificate to enable HTTPS on the local listener. |
--cert-password |
Password for the cert file, if encrypted. |
--listen-to-any |
Bind to 0.0.0.0 instead of localhost. Useful for testing from another device on the same network. Default false. |
--enable-cors |
Enable CORS on the local server. Default false. |
--path-base |
Mount the dev server under a base path (e.g. /myapp). |
How it works
Under the hood, serve:
- Starts a local Kestrel server pointing at your
h5/folder. - Patches the workspace's served HTML so the browser loads your JS bundle.
- Proxies all
/api/...calls to the configured--server. - Watches the
h5/folder and reloads when the bundle changes.
For this to work, the remote workspace must allow CORS from the dev server's origin. Add http://localhost:5000 (or whatever port you used) to the MSK_CORS environment variable and restart the workspace process.
Typical workflow
See Custom Front-End development workflow for the full loop. The short version:
dotnet build
curiosity-cli serve -s http://localhost:8080 -p bin/Debug/netstandard2.0/h5
# Iterate, then when ready:
curiosity-cli upload-front-end -s http://localhost:8080 -t $CURIOSITY_TOKEN -p bin/Debug/netstandard2.0/h5
Remarks
- Use
serveto iterate on a custom front-end locally while talking to a remote workspace, instead of re-uploading after each change. - The target folder must be a compiled
Mosaik.FrontEndbundle (it must contain amosaik.appmarker), and the remote workspace must allow CORS from the dev server's origin. - Pass
--serverexplicitly; the URL-guessing fallback is for convenience only and shouldn't be relied on.--ignore-certificate-errorsis for local development only.
See also
upload-front-end— push the bundle to the workspace when iteration is done.- H5 Getting Started — the compiler that produces the
h5/folder. - Tesserae UI — the component library most custom front-ends are built on.
- Custom Front-End development workflow.