Serve

Use this skill when the user wants to serve static files via HTTP.

javimosch b580f16 1.1 KB Updated

File contents

Serve Plugin

Static file serving and directory listing. Production-ready static file server.

Commands

File Serving

  • serve directory serve — Serve a directory as static HTTP server

Usage Examples

  • "serve directory serve --path ./public"
  • "serve directory serve --path ./public --port 8080"

Installation

npm install -g serve

Examples

# Serve current directory
serve

# Serve specific directory
serve ./public

# Serve on custom port
serve -p 8080

# SPA mode (rewrites all requests to index.html)
serve -s

# Disable caching
serve -n

# Open browser automatically
serve -o

# Custom listen address
serve -l tcp://0.0.0.0:3000

# Set custom headers
serve -h '{"Access-Control-Allow-Origin": "*"}'

# Enable CORS
serve -c

Key Features

  • Production-ready static file server
  • SPA support with --single flag
  • Directory listing
  • CORS support
  • Custom headers
  • Automatic browser opening
  • Caching control
  • Zero-configuration

javimosch/supercli/tree/main/plugins/serve/skills/quickstart commit b580f166e2

Frequently asked questions

npx skillmds@latest add javimosch/serve