zoukankan      html  css  js  c++  java
  • http-server

    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: * Disallow: /')

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

  • 相关阅读:
    元类、orm
    MySQL进阶
    python操作mysql
    tf矩阵基础
    tensorflow安装时遇到的问题
    Loading
    弹球落地
    3dMenu
    响应式布局:flex
    渐变linear-gradient
  • 原文地址:https://www.cnblogs.com/xuepei/p/9830069.html
Copyright © 2011-2022 走看看