zoukankan      html  css  js  c++  java
  • indexzero/http-server-2-使用

    所以在ethereumjs-vm/examples/run-transactions-simple例子中要怎么使用http-server

    1.首先在ethereumjs-vm/examples/run-transactions-simple目录下将http-server运行起来:

    userdeMBP:run-transactions-simple user$ http-server
    Starting up http-server, serving ./
    Available on:
      http://127.0.0.1:8080
      http://192.168.199.233:8080
    Hit CTRL-C to stop the server

    2.然后就能够在浏览器中访问当前目录下的文件了,首先可以查看一个该目录下有什么文件:

    userdeMBP:run-transactions-simple user$ ls
    README.md    bundle.js    index.html    index.js

    3.然后在浏览器中访问http://127.0.0.1:8080,就会自动访问到当前目录下的index.html文件

    服务器返回:

    userdeMBP:run-transactions-simple user$ http-server
    Starting up http-server, serving ./
    Available on:
      http://127.0.0.1:8080
      http://192.168.199.233:8080
    Hit CTRL-C to stop the server
    [Wed Dec 12 2018 14:12:22 GMT+0800 (中国标准时间)] "GET /" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36"
    [Wed Dec 12 2018 14:12:22 GMT+0800 (中国标准时间)] "GET /bundle.js" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36"
    [Wed Dec 12 2018 14:12:23 GMT+0800 (中国标准时间)] "GET /favicon.ico" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36"
    [Wed Dec 12 2018 14:12:23 GMT+0800 (中国标准时间)] "GET /favicon.ico" Error (404): "Not found"

    浏览器返回:

    如果当前目录下没有index.html文件,将返回:

    这就是你打开http-server的当前目录的所有文件和文件夹,然后就能够通过点击进行访问。因为我将index.html放到了views文件夹下,点击views文件夹,就能够访问index.html了:

    4.访问http://127.0.0.1:8080/index.js

    就能够在浏览器打开index.js文件

    使用http-server的好处就是能够十分快速地开启一个服务器,并能够在浏览器上给出当前目录的所有文件,可以通过点击进行调用

  • 相关阅读:
    JLOI2012:时间流逝
    bzoj 5217: [Lydsy2017省队十连测]航海舰队
    bzoj 4894: 天赋
    bzoj 4870: [Shoi2017]组合数问题
    bzoj 1558: [JSOI2009]等差数列
    bzoj 4945: [Noi2017]游戏
    bzoj 2142: 礼物
    bzoj 5248: [2018多省省队联测]一双木棋
    51nod2383
    codeforces24D
  • 原文地址:https://www.cnblogs.com/wanghui-garcia/p/10109401.html
Copyright © 2011-2022 走看看