LoginSignup
1
2

More than 3 years have passed since last update.

開発作業のためにSimpleなlocal webサーバを速攻で立てる

Posted at

開発作業のためにSimpleなlocal webサーバを速攻で立てる

  • 開発のためにlocalhostでwebサーバを速攻で建てたい!!ってことがある。
  • dockerでnginx、とかもあるが、ただ使い捨てのjs貼り付けただけのhtml確認するのにnginx.conf書いて、とかもだるい。ともかく速攻でhtmlファイルのあるフォルダをDocumentRootにしてwebサーバを立ち上げたい!!って時。

結論(macの場合)

python -m SimpleHTTPServer
  • macだと元から入っているpythonでSimpleHTTPServer起動すればそれが最速。。。素敵。。。

それ以外

結論出ちゃってるのであれですが。
nodeが入っているなら以下の2つも簡単。

superstatic(npm package)

npm i -g superstatic
cd 公開したいファイルのあるフォルダ
superstatic
  • 色々オプションもあるらしいがhtmlを見るだけならこれでok。

http-srever(npm package)

npm i -g superstatic
cd 公開したいファイルのあるフォルダ
http-server -c -1
  • -c -1はキャッシュdisableにするおまじないです(デフォルトでは3600sec)。
1
2
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
2