# Demo_egg **Repository Path**: xuchaoxin1375/demo_egg ## Basic Information - **Project Name**: Demo_egg - **Description**: demo of egg - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-11-27 - **Last Updated**: 2021-12-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # this repository is a collection repository of egg.js demo projects ## folders for different projects - if you want to create a new project ,you'd better to create a new directory for the new project to be create by `yarn create egg --type=simple` --- [ Egg.js环境搭建和HelloWorld](http://jspang.com/detailed?id=79#toc33)直接开始操作,来安装Egg.js的开发环境和编写第一个 `HelloWorld`。 以管理方式打开Windows中的 `PowerShell`(如果不以管理员方式打开,没办新建目录),选择要创建目录的位置。然后创建目录。 ```jsx mkdir egg // 创建egg目录 cd egg // 进入egg目录 ``` 使用yarn命令来创建一个egg项目,命令如下。 ```jsx yarn create egg --type=simple ``` 如果你没安装yarn命令,可以使用下面这条命令进行安装。 ```jsx npm install -g yarn ``` 这时候yarn会给我们去远程拉去egg.js框架和生成项目。其中有几项需要我们配置:项目名称、描述和作者。如果不愿意配置,也可以直接略过。 创建完成后,我们需要安装相关的项目依赖。 ```jsx yarn install ``` 安装完成后,我们用 `yarn dev`开启项目,开启后会告诉我们 访问地址为 `http://127.0.0.1:7001`。 打开浏览器,输入地址,就会在页面中显示出 `hi.egg`。 ## yarn or npm? - I would like use `yarn` to build and develop my projects. - ### start your project server and show in browser quickly ## failures and error - start(dev) the project error: - it may be your project contained error code (espacially functoins with error spelling or type parameter ,so the code running uncorrectly and throw error ) - most cases is that the error generate by the error spelling in the path string(router string paramter),unfortunately, the IDE wouldn't tell you these mose common error! - so be carefully to write your codes * if your find you failed to open a curtain page in browser,than use you first to check your terminal, to learn about whether it is the project code contains uncorrenct code or configs,than to do further operations. * wrong spelling or punctuation-mark: * ![img](https://gitee.com/xuchaoxin1375/pictures/raw/main/images/20211204162843.png) * `.`& `,` * `export` &'require` * `request`&`reqeust` * `use` & `user` * `and so on...` --- ### database configuration and errors * you'd better keep the cloud server with the same configuration of datebase with local development environment. * what's more ,you need to create the corresponding datebase in your cloud(deploying) environment ,if your code do not have related mechanism to solve the unexpected cases! ## dependencies & package.json - you can should install(by `yarn` or `npm`) in the project directory - check the plugins installation information int the `egg` project root directory in the `package.json `file :`dependencies{}` - ## for git clone to deploy(fork to run each project ) - you need to run `yarn install` or `npm install ` to install the dependencies yourself manually (beacause the `.gitignore` will ignore the `node_modules` to push to the remote git repository)