LoginSignup
4
3

More than 1 year has passed since last update.

ローカル確認のための簡易サーバ(http-server)

Last updated at Posted at 2019-10-30

結構便利だったのに忘れてしまって、次に探さないためのメモ。

【用途】
ローカル環境でhtmlファイルなどの簡易的な確認を行いたい時に、いちいち面倒なconfの設定などせずにすぐに実行できて便利。

事前準備:ツールのインストール

どっちでインストールしたか忘れた。npmだったか。brewでもインストールできる模様。

npmの場合

npm install -g http-server

brewの場合

brew install http-server

npm https://www.npmjs.com/package/http-server
brew https://formulae.brew.sh/formula/http-server

使い方

Terminalで確認したいファイルがある任意のディレクトリまで移動して起動

cd ./hoge/hage

http-server

Starting up http-server, serving ./
Available on:
  http://127.0.0.1:8080
  http://10.215.10.165:8080

127.0.0.1:8080か、localhost:8080でブラウザ確認できるようになる。

以上。

参考:https://utano.jp/entry/2018/02/npm-http-server/

4
3
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
4
3