Use Koa scaffolding koa-generator to create projects (use KOA to create a complete website 2)

The advantage of using scaffolding to create a project is that a tool can help us complete many steps to complete, and some dependencies and initialization work are handed over to the scaffolding. koa-generator is a tool used to create a basic koa project.
1. To install koa-generator, we can use global or local installation. Here we use global installation. However, in the test here, we found that the yarn global add global installation cannot use the Ko2 command in the current environment. This command cannot be found, so we can only Enter the bin directory of koa-generator in node_module and execute node koa2 app1 to complete the project creation, but the command can be generated normally after installation with npm i koa-generator. It is found that the location of this command is generated in C:\Users\Administrator\AppData\Roaming\npm

PS D:\chen\nodejs\zizch> yarn global add koa-generator
或者:npm i koa-generator -g 

2. Create a project through koa2, and the generated project contains some main modules and configurations. It is indeed more comprehensive than our own step-by-step configuration.

PS D:\chen\nodejs> koa2 app1

insert image description here

Guess you like

Origin blog.csdn.net/weixin_36557877/article/details/129355913