CLI Examples
This page show Static CLI command usage
Start Command
| Command | Description |
|---|---|
| static start | Start local server |
| static stop | Stop local server |
| static restart | Restart local server |
| static status | Show server status |
Flags
| Flags | details |
|---|---|
| -h or --help | Info of all commands and usage |
| -v or --version | Print static-cli version |
| -p or --port | start server on specific port |
| --spa | If file not found instead of 404 status code it will send html file in response. |
| --gzip | This mode sending gzip encoded file and folder for fast file transfer |
| --gui | It provides you web gui interface of you file system access : http://localhost:3000/__dashboard |
| --includes | Include file/folder using (glob) pattern. Multiple patterns separated by ";" ALSO path must inside quotes ""Example: "src/**/*.js;assets/**/*.css" |
| --excludes | Excludes file/folder using (glob) pattern. Multiple patterns separated by ";" ALSO path must inside quotes ""Example: "node_modules/**;dist/**" |
| --open or --browse | Open url in browser |
| --allowed-create | It provide to create a file |
| --allowed-rename | It provide to rename a file |
| --allowed-delete | It provide to delete a file |
| --allowed-update | It provide to update a file |
Usage
Gui Mode
static start --guiInstant open in browser use --open or --browse flag
static start --gui --openPublic Mode
prerequisite: install cloudflared tunnel see installation
Available for - mac | linux | windows
static start --public --openIt Provides you a public url which connect your local server to internet
Includes Or Excludes
To include or exclude specific file or folder use these Flags using Glob-Pattern
static start --excludes "*.txt"
static start --includes "**/*.mk4"
INFO
By default server send index.html file on slash
/if found otherwise not-found with 404 status code.Our Server always send file with "Content-Disposition" with "attachment" that's mean if you request from client side like Browser then it will automatically downloaded or Browser asked you to where to save file
If you want browser show your file then you can add?show=truein query like http://localhost:3000/bhola.mp4?show=true then your file load in browser if your file is renderable otherwise it would be downloaded
To List all files in specific Directory append /ls at end of path
curl http://localhost:3000/folder/lsTo see stat of file add info=true in query
curl http://localhost:3000/folder?info=trueCrud
curl http://localhost:3000/file.txt?create=truecurl http://localhost:3000/folder?rename=new-foldercurl http://localhost:3000/index.html?update=truecurl http://localhost:3000/folder?delete=true