LoginSignup
11
12

More than 5 years have passed since last update.

ワンライナーで sinatra static file サーバーを起動

Last updated at Posted at 2013-02-17
sh
$ ruby -rsinatra -e 'set :public_folder, "."; set :static_cache_control, "no-store"' -- -p 3000 -o 0.0.0.0

同じディレクトリに index.html があれば、http://localhost:3000/index.html で開けます。

サーバー無しの HTML5 web アプリのプロトタイプみたいなのつくるときに便利。

EDIT: 2013-04-27: 他のホストや your-mac.local のようなホスト名でアクセスできるようにするために -o 0.0.0.0 オプション追加
EDIT: 2013-09-14: 開発中はブラウザにキャッシュされると困るので Cache-Control: no-store

11
12
2

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
11
12