# egg-practice-demo **Repository Path**: DoraZC/egg-practice-demo ## Basic Information - **Project Name**: egg-practice-demo - **Description**: egg练手demo - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-11-30 - **Last Updated**: 2022-01-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # egg ## QuickStart see [egg docs][egg] for more detail. 学习视频地址https://jspang.com/detailed?id=79 文档链接https://eggjs.org/zh-cn/intro/quickstart.html npm init egg --type=sample yarn install yarn dev yarn start //修改需要重新启动服务器 yarn dev //不需要启动服务器 ### Development ```bash $ npm i $ npm run dev $ open http://localhost:7001/ ``` ### Deploy ```bash $ npm start $ npm stop ``` ### npm scripts - Use `npm run lint` to check code style. - Use `npm test` to run unit test. - Use `npm run autod` to auto detect dependencies upgrade, see [autod](https://www.npmjs.com/package/autod) for more detail. [egg]: https://eggjs.org Service 封装的一个抽象层 数据库交互的代码 1 保持 Controller 逻辑更加简单 2 独立性 Service 多个 Controller 3 写测试用例简单 Controller egg.js 特点 1、对 SEO 非常友好 2、Egg PHP 得到了后端的一致性认可 3.前后端分离分离的一种补充 一次登录 SPA ThinkPHP to EJS 安装方法 npm i egg-view-ejs --save 或者 yarn add egg-view-ejs 在 config plugin.js config.default.js 中都要进行配置 安装 egg-mysql 与数据库实现交互 yarn add egg-mysql -S