Created
January 23, 2013 16:50
-
-
Save mugifly/4609696 to your computer and use it in GitHub Desktop.
How to use the Morbo (include Mojolicious) as a simple http daemon. For example, it will be useful for doing development with XMLHTTPRequest(Javascript) on localhost.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use Mojolicious::Lite; | |
push @{app->static->paths}, 'site/'; # File path | |
app->start('daemon'); | |
# Execute this script on terminal: perl daemon.pl | |
# Then, let's access to http://localhost:3000/*** |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
コマンドとして呼び出せるようにして、
のようにカレントディレクトリを指すようにしておけば、コマンドを打つだけでサッとHTTPアクセスできるようになります。
(※index.htmlなどでもファイル名を入力しないと、404Errorになるので注意。)