create nwf application - elvinzeng/nwf GitHub Wiki
First, update you NPLRuntime to latest version and set up environment variables for NPL.
Now, you only need to run the following command:
~ $ cd ~/workspace
~/workspace $ curl -O https://raw.githubusercontent.com/elvinzeng/nwf/master/nwf_init.sh
~/workspace $ sh ./nwf_init.sh "project-name"
Then, this script will use parameter "project-name" to create a directoty as project root directory, it will generate the necessary directory structure and the basic file automatically.
tips: you can use git-bash to run script if you are Windows user.
Attention: Since the project auto update script will check the file changes by calculating the file checksum , If the git client is configured to automatically convert the line style will cause the project auto update script be not available. To resolve this issue, configure the git client line style conversion behavior in terminal or git-bash by executing the following command before creating or clone projects.
git config --global core.autocrlf input
. --> project root directory βββ module_source_repos.conf --> module source config file βββ dependencies.conf --> configure all dependencies of this project βββ reinitialize.sh --> reinitialize project utilοΌinit all git submodulesοΌ βββ npl_packages --> npl packages root directory β βββ main --> root dir of NPL main package β βββ nwf --> root dir of nwf package βββ .nwf --> some data generate by nwf utils β βββ init_flag --> a file to record initialization info β βββ md5sum --> checksum of file generate by framework βββ pack.sh --> compress application source code to .tar.gz file βββ restart_debug.sh --> restart webserver(linux) βββ shutdown.sh --> shutdown webserver(linux) βββ start.sh --> start webserver(linux) βββ start_win.bat --> start webserver(Windows) βββ start_win_auto_update.sh --> run webserver and auto update packages(Windows) βββ update_project.sh --> update packages(linux and Windows) βββ www --> web application source code root dir. βββ app_initialized.lua --> this script will run after website started βββ controller --> controllers β βββ DemoController.lua β βββ RootController.lua βββ mvc_settings.lua --> framework init file, used as a config file. βββ router.lua --> framework core module βββ modules --> root dir of nwf modules βββ static --> root dir of css,js,fonts βββ validator --> validators β βββ DemoValidator.lua βββ view --> templates β βββ test.html βββ webapp.lua --> framework core module βββ webserver.config.xml --> NPL WebServer config file
<config>
<string name='DEV_MODE'>debug</string>
<table name='db'>
<string name='host'>localhost</string>
<string name='user_name'>postgres</string>
<string name='user_password'>123456</string>
<string name='database'>test</string>
<string name='port'>5432</string>
</table>
</config>
First, configure dependencies module of this project.
elvin@elvin-idreamtech ~/workspace/testnwf $ cat dependencies.conf
preload_controller_mod
helloworld
Then, execute below command to install all dependences module.
~ $ ./nwf_module_manage.sh -I
If you are not familiar with module, you could skip this step and start server directly.
- Linux: sh start.sh
- Windows: run start_win.bat
- Access "http://localhost:8099/ ". "it works!" means web application is start success.