一、第一阶段,熟悉Quickstart基本情况
Quickstart是Nitrogen的样本应用,通过分析它,了解如何制作处理动态网页,如何完成Web操作,如何装配“网站”等等。
1、把目录D:/nitrogen/Quickstart复制到D:,改名Quickstart2后,复制回D:/nitrogen/Quickstart2
以后的实验,在目录D:/nitrogen/Quickstart2中进行。
2、在DOS shell中执行命令:
D:/nitrogen/Quickstart2 > quickstart.bat
屏上显示:
Eshell V5.6.5 (abort with ^G)
(nitrogen@127.0.0.1)1>
---
(nitrogen@127.0.0.1)1> Nitrogen is now running on inets.
(nitrogen@127.0.0.1)1> Serving files from: ./wwwroot.
(nitrogen@127.0.0.1)1> Open your browser to: http://localhost:8000
(nitrogen@127.0.0.1)1> ---
可见,Nitrogen依托的服务器,是Erlang自带的Inets;
网页文件,保存在子目录/wwwroot;
服务器运行在端口8000:
验证运行,可在浏览器中打开:http://localhost:8000
3、分析批命令文件quickstart.bat
@echo off
echo Copy Nitrogen WWW files into ./content/wwwroot/nitrogen
rmdir /s /q ./wwwroot/nitrogen
mkdir ./wwwroot/nitrogen
copy ../www/* ./wwwroot/nitrogen
echo Starting Nitrogen on Inets...
erl -make
erl -name nitrogen@127.0.0.1 -pa apps ebin include -pa ../ebin ../include -eval "application:start(quickstart_inets)"
前6句的操作任务是:
@echo off 不显示命令执行的过程和结果
echo Copy Nitrogen WWW files into ./content/wwwroot/nitrogen
显示一行:Copy Nitrogen WWW files into ./content/wwwroot/nitrogen
rmdir /s /q ./wwwroot/nitrogen
删除目录wwwroot/nitrogen及其子目录,并且不需要用户确认
mkdir ./wwwroot/nitrogen
创建目录wwwroot/nitrogen
copy ../www/* ./wwwroot/nitrogen
从目录D:/nitrogen/www中,复制全部文件到D:/nitrogen/Quickstart2/nitrogen
echo Starting Nitrogen on Inets...
显示一行:Starting Nitrogen on Inets...