使用mochiweb开发基于erlang的web应用。
参考资料:http://alexmarandon.com/articles/mochiweb_tutorial/
中文翻译:http://www.cnblogs.com/ken-zhang/archive/2011/10/24/2222202.html
命令行:
$ git clone git://github.com/mochi/mochiweb.git
$ cd mochiweb
$ make app PROJECT=greeting
$ cd ../greeting/ $ make $ ./start-dev.sh默认是8080端口启动,访问http://localhost:8080即可。
另外,如果需要在后台始终运行服务,需要修改start-dev.sh文件如下:
#!/bin/sh
# NOTE: mustache templates need \ because they are not awesome.
exec erl -pa ebin edit deps/*/ebin -boot start_sasl \
-sname dyco_dev \
-s dyco \
-s reloader \
-noinput -hidden
亦即需要加入-noinput -hidden的指令。
然后使用如下命令启动程序即可:
$ nohup ./start-dev.sh &