http-server是基于node.js的一个简单、零配置的命令行web服务器,可以方便实现跨域资源请求,

#全局安装:

npm install http-server -g; 全局安装后就可以通过命令行来启动了

使用:

http-server [path] [options];
/*`[path]` defaults to `./public` if the folder exists, and `./` otherwise.*/

#安装为一个node应用

mkdir myapp
cd myapp/
jitsu install http-server
/*如果没有安装`jitsu`,可通过`npm install jitsu -g`命令进行安装*/

使用:

本地启动http-server:

node bin/http-server
/*此时可访问 http://localhost:8080 查看服务器*/

可用的选项:

-p:端口号(默认使用8080)

-a:address to use(默认使用0.0.0.0)

-d:Show directory listings (defaults to 'True')

-i:Display autoIndex (defaults to 'True')

-e 或 --ext:Default file extension if none supplied (defaults to 'html')

-s 或 --silent:Suppress log messages from output

--cors:Enable CORS via the `Access-Control-Allow-Origin` header

-o:Open browser window after starting the server

-c:Set cache time (in seconds) for cache-control max-age header, e.g. -c10 for 10 seconds (defaults to '3600'). To disable caching, use -c-1.

-U 或 --utc:Use UTC time format in log messages.

-P 或 --proxy:Proxies all requests which can't be resolved locally to the given url. e.g.: -P http://someurl.com

-S 或 --ssl:Enable https.

-C 或 --cert:Path to ssl cert file (default: cert.pem).

-K 或 --key:Path to ssl key file (default: key.pem).

-r 或 --robots:Provide a /robots.txt (whose content defaults to 'User-agent: *\nDisallow: /')

-h 或 --help:Print this list and exit.

http-server的更多相关文章

  1. 最近帮客户实施的基于SQL Server AlwaysOn跨机房切换项目

    最近帮客户实施的基于SQL Server AlwaysOn跨机房切换项目 最近一个来自重庆的客户找到走起君,客户的业务是做移动互联网支付,是微信支付收单渠道合作伙伴,数据库里存储的是支付流水和交易流水 ...

  2. SQL Server 大数据搬迁之文件组备份还原实战

    一.本文所涉及的内容(Contents) 本文所涉及的内容(Contents) 背景(Contexts) 解决方案(Solution) 搬迁步骤(Procedure) 搬迁脚本(SQL Codes) ...

  3. Sql Server系列:分区表操作

    1. 分区表简介 分区表在逻辑上是一个表,而物理上是多个表.从用户角度来看,分区表和普通表是一样的.使用分区表的主要目的是为改善大型表以及具有多个访问模式的表的可伸缩性和可管理性. 分区表是把数据按设 ...

  4. SQL Server中的高可用性(2)----文件与文件组

        在谈到SQL Server的高可用性之前,我们首先要谈一谈单实例的高可用性.在单实例的高可用性中,不可忽略的就是文件和文件组的高可用性.SQL Server允许在某些文件损坏或离线的情况下,允 ...

  5. 从0开始搭建SQL Server AlwaysOn 第一篇(配置域控)

    从0开始搭建SQL Server AlwaysOn 第一篇(配置域控) 第一篇http://www.cnblogs.com/lyhabc/p/4678330.html第二篇http://www.cnb ...

  6. 从0开始搭建SQL Server AlwaysOn 第二篇(配置故障转移集群)

    从0开始搭建SQL Server AlwaysOn 第二篇(配置故障转移集群) 第一篇http://www.cnblogs.com/lyhabc/p/4678330.html第二篇http://www ...

  7. 从0开始搭建SQL Server AlwaysOn 第三篇(配置AlwaysOn)

    从0开始搭建SQL Server AlwaysOn 第三篇(配置AlwaysOn) 第一篇http://www.cnblogs.com/lyhabc/p/4678330.html第二篇http://w ...

  8. 从0开始搭建SQL Server AlwaysOn 第四篇(配置异地机房节点)

    从0开始搭建SQL Server AlwaysOn 第四篇(配置异地机房节点) 第一篇http://www.cnblogs.com/lyhabc/p/4678330.html第二篇http://www ...

  9. SQL Server on Linux 理由浅析

    SQL Server on Linux 理由浅析 今天的爆炸性新闻<SQL Server on Linux>基本上在各大科技媒体上刷屏了 大家看到这个新闻都觉得非常震精,而美股,今天微软开 ...

  10. SQL Server相关书籍

    SQL Server相关书籍 (排名不分先后) Microsoft SQL Server 企业级平台管理实践 SQL Server 2008数据库技术内幕 SQL Server性能调优实战 SQL S ...

随机推荐

  1. 浅析libuv源码-编译启动

    面试的间隙回头复习了一下node,感觉node就像一个胶带,把V8和libuv粘在了一起. V8毫无疑问,负责解析执行JavaScript,相当于语言层面的桥梁:而libuv则是负责操作系统底层功能的 ...

  2. new~mac os 给终端命令写alias(及其他常用命令)及软连接

    配置执行顺序 优先级 配置 说明 1 /etc/profile 系统级别 —— 不推荐修改 2 /etc/paths 系统级别 —— 不推荐修改 3 ~/.profile 用户设置 4 ~/.bash ...

  3. String 字符串相加比较

    String 字符串相加 对比 public static void main(String[] args) { String a = "helloword"; final Str ...

  4. Doclever 接口mock 操作

    查看 接口项目mock 查看说明 假设 本机项目路径为  http://localhost:8080 >> 启动 node node net.js http://org.my.com/mo ...

  5. python 系列文章汇总(持续更新...)

    引言 不知不觉已经写了好几篇 python 相关的随笔了,从刚开始的门外汉到现在已经对 python 有一些入门了,时间也已经过去了一个多月. 写博客真是好处多多,不仅能提供整理自己学习的知识点,梳理 ...

  6. Listary Pro- 文件浏览与搜索增强的超级神器

    Listary 是一款 Windows 文件浏览增强工具,为 Windows 资源管理器增加智能命令.最近文档以及收藏功能.文件小,功能强大.秒杀系统自带搜索功能!! 它是一款非常优秀的 Window ...

  7. CSS计数器(序列数字字符自动递增)详解———张鑫旭

    by zhangxinxu from http://www.zhangxinxu.com本文地址:http://www.zhangxinxu.com/wordpress/?p=4303 一.挖坟不可耻 ...

  8. python-建造者模式

    源码地址:https://github.com/weilanhanf/PythonDesignPatterns 说明: 假如要组装一台电脑,将主板,CPU,内存等部件按照某个稳定的步骤组合,基本过程是 ...

  9. 地区picker 各选择器,优劣分析

    移动端选择器picker有很多,各大ui组件都有自己的picker,比如light7,HUI,MUI,jqueryUI等等.但是,我发现他们都有各种各样的问题.这次的地区选择,需要地区的省份+市+经纬 ...

  10. JavaScript:作用域与作用域链

    1.什么是作用域(scope)? 简单来讲,作用域(scope)就是变量访问规则的有效范围. 作用域外,无法引用作用域内的变量: 离开作用域后,作用域的变量的内存空间会被清除,比如执行完函数或者关闭浏 ...