# 静态服务器 —— http-server

# 1. 安装

# Using npx you can run the script without installing it first:
npx http-server [path] [options]

# Globally via npm
npm install --global http-server

# 2. 使用

语法:

  • http-server [path] [options]

path:

  • defaults to ./public if the folder exists, and ./ otherwise.

options:

  • -c-1: 不缓存
  • -o [path]: 打开浏览器

# 3. 示例

npx http-server . -c-1 -o

# 4. 参考

本章目录