博文地址
我的GitHub | 我的博客 | 我的微信 | 我的邮箱 |
---|---|---|---|
baiqiantao | baiqiantao | bqt20094 | baiqiantao@sina.com |
目录
Static file serving and directory listing.
serve a
static site
, asingle page application
, astatic file
, no matter if on yourdevice
or on thelocal network
最简单的使用方式:在当前目录下执行命令npx serve
即可。
yarn global add serve # 全局安装 serve
serve -v # 查看版本
serve --help # 查看帮助文件
serve # 在当前目录下启动服务,启动后会自动将地址拷贝到粘贴板
serve -p 10086 # 在当前目录下启动服务,并指定端口【http://localhost:10086】
serve folder_name # 在指定的目录下启动服务
By default, serve will listen on 0.0.0.0:3000 and serve the current working directory on that address.
常用
-l
, listen:Specify a URI endpoint 端点 on which to listen, more than one may be specified to listen in multiple places-p
, port:Specify custom port 端口-d
, debug:Show debugging information-s
, single:Rewrite all not-found requests to index.html
不常用
-c
, config:Specify custom path to serve.json
-C
, cors:Enable CORS, sets Access-Control-Allow-Origin
to *
-n
, no-clipboard:Do not copy the local address to the clipboard-u
, no-compression:Do not compress files-S
, symlinks:Resolve symlinks instead of showing 404 errors--no-etag
:Send Last-Modified
header instead of ETag
--ssl-cert
:Optional path to an SSL/TLS certificate to serve with HTTPS--ssl-key
:Optional path to the SSL/TLS certificate's private key 私钥--ssl-pass
:Optional path to the SSL/TLS certificate's passphrase 密钥--no-port-switching
:Do not open a port other than 除了 the one specified when it's taken.监听端口
Listen endpoints (specified by the --listen or -l options above) instruct 指示 serve to listen on one or more interfaces/ports
, UNIX domain sockets
, or Windows named pipes
.
serve -l 1234
serve -l tcp://hostname:1234
serve -l unix:/path/to/socket.sock
serve -l pipe:\\.\pipe\PipeName
一款高度简洁的微信 Markdown 编辑器:支持 Markdown 所有基础语法、色盘取色、一键复制并粘贴到公众号后台、多图上传、一键下载文档、自定义 CSS 样式、一键重置等特性
开发和部署
npm i # 安装依赖
npm run serve # 启动开发模式
npm run build # 输出部署版本
2017-01-16
本文来自博客园,作者:白乾涛,转载请注明原文链接:https://www.cnblogs.com/baiqiantao/p/6290306.html