First, the front-end standard environment
1, Nodejs correct installation, you can refer to: http://www.cnblogs.com/chengxs/p/6221393.html
2, git properly installed, you can refer to: http://www.cnblogs.com/chengxs/p/6244023.html
Second, install the THINKJS command
NPM install-g THINK-CLI
After the installation is complete, there will be a command on the system (you can view the version number of the thinkjs
thinkjs -v
think-cli, this version number is not THINKJS version number). If this command is not found, verify that the environment variable is correct.
Iii. Creation of the project
Execute the following statement to create the project, such as:
New
And then
CD DEMO;NPM install; NPM start;
IV. Structure of the project
The project structure created by default is as follows:
|---development.js//Portal files in the development environment|---nginx.conf//nginx configuration file|---Package.json|---Pm2.json//PM2 configuration file|---production.js//import file in production environment|---readme.md|---src| |---Bootstrap//start the Auto-execute directory| | |---master.js//automatic execution under Master process| | |---worker.js//automatic execution under Worker process| |---Config//Configuration file Directory| | |---adapter.js//Adapter configuration file| | |---config.js//Default configuration file| | |---config.production.js//default profile in production environment, and Config.js merge| | |---extend.js//Extend configuration file| | |---middleware.js//Middleware configuration file| | |---router.js//Customizing the routing configuration file| |---Controller//Controller Directory| | |---Base.js| | |---Index.js| |---logic//Logic Directory| | |---Index.js| |---model//Model Catalog| | |---Index.js|---View//Template Catalog| |---index_index.html|---www| |---Static//Static Resource Directory| | |---CSS| | |---img| | |---JS
Five, the effect
Open browser Access http://127.0.0.1:8360/
, if the project is created on the remote machine, you need to change the IP address.
The effect is as follows:
You can refer to the official documentation: https://thinkjs.org/zh-cn/doc/3.0/create_project.html
Thinkjs Framework Getting Started detailed tutorial (i) Development environment