-
-
Notifications
You must be signed in to change notification settings - Fork 78
TutorialWebSite
Li, Xizhi edited this page Sep 16, 2016
·
13 revisions
In this tutorial, you will learn how to create a web site like this with NPL. The following topics will be covered:
- setup NPL web development environment
- NPL server page programming model
- Debugging and logs
- Use table database
- MVC frameworks for serious web development
- For more information, read WebServer
For more information, see Install Guide. The following is only about the recommended IDE under win32.
- Install Git so that you can call
git
command from your cmd line. - Download ParacraftSDK
- or you can clone it by running:
git clone https://github.com/LiXizhi/ParaCraftSDK.git
- Make sure you have updated to the latest version, by running
./redist/paracraft.exe
at least once - Run
./NPLRuntime/install.bat
- The NPL Runtime will be automatically copied from
./redist
folder to./NPLRuntime/win/bin
- The above path will be added to your
%path%
variable, so that you can run npl script from any folder.
- The NPL Runtime will be automatically copied from
- Download and install Visual Studio Community Edition: the free version of
visual studio
- In visual studio, select
menu::Tools::Extensions
, and search online fornpl
orlua
to install following plugins:- NPL/Lua language service for visual studio: this will give you all the syntax highlighting, intellisense and debugging capability for NPL in visual studio.
- In visual studio, select
NPL is a dynamic language, it does not require you to build anything in order to run, so you can create any type of visual studio project you like and begin adding files to it.
There are two ways to do it: use the lazy one but read the manual one.
- run
git clone https://github.com/tatfook/wikicraft.git
- cd into the source directory and run
./update_packages.bat
- open the
sln
file with visual studio - run
start.bat
, you will see the npl server started.- visit http://localhost:8099 for the main site.
- visit http://127.0.0.1:8099 for the NPL code wiki web site.
- rename the project to your preferred name and begin coding in the
./www
folder. (see next chapter) - finally, see the
configure the project property
step inthe manual one
section.
- create an empty visual studio project: such as a C# library or VC++ empty project.
- install the main npl package into your project root directory.
mkdir npl_packages
cd npl_packages
git clone https://github.com/NPLPackages/main.git
- configure the project property to tell
visual studio
to start NPLRuntime with proper command line parameters when we pressCtrl+F5
.- For the external program: we can use either
npl.bat
orParaEngineClient.exe
, see below- program:
D:\lxzsrc\ParaCraftSDKGit\NPLRuntime\win\bin\ParaEngineClient.exe
- parameters:
bootstrapper="script/apps/WebServer/WebServer.lua" port="8099" root="www/" servermode="true" dev="D:/lxzsrc/wikicraft/"
- working directory:
D:/lxzsrc/wikicraft/
- Note: the
dev
param and working directory should be the root of your web project directory.
- Note: the
- program:
- For the external program: we can use either
Download Paracraft | ParacraftSDK | copyright by tatfook 2016 | upload image