LoginSignup
1
0

More than 3 years have passed since last update.

[4行] 静的サイトをローカルホスティングして他のデバイスからアクセスする

Last updated at Posted at 2019-09-23

npmは入っている前提
静的サイトにおけるieやスマホなど別のデバイス(実機/vm)での挙動を確かめたい場合

$ cd workspace # 静的サイトの所在に移動
$ npm init -y # package.jsonの生成
$ npm install --save local-web-server # nodeパッケージをローカルインストール
$ npx ws --spa index.html # htmlをホスティング
# -> Listening on http://xxxx.local:8000, http://127.0.0.1:8000, http://172.20.10.6:8000

同じネットワーク上にあるなら上記の例でいうとhttp://172.20.10.6:8000でアクセスできる

以上。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0