1.创建 service 文件 app/service/article.js const Service = require('egg').Service; class ArticleService extends Service { async create(params ...
.开发文章首页接口 app service article.js const Service require egg .Service class ArticleService extends Service async lists const app this try const result await app.mysql.select article return result catch ...
2020-03-05 12:00 0 1005 推荐指数:
1.创建 service 文件 app/service/article.js const Service = require('egg').Service; class ArticleService extends Service { async create(params ...
1.创建service文件 app/service/product.js const Service = require('egg').Service; class ProductService extends Service { async index ...
1.安装 ejs yarn add egg-view-ejs 2.修改配置 config/plugin.js 'use strict'; exports.ejs = { enable: true, package: 'egg ...
1.GET 方法 // 商品详情 async detail() { const { ctx } = this; console.log(ctx.query); ctx.body = `id==${ctx.query.id}`; } async detail2 ...
什么是Egg.js Egg.js 为企业级框架和应用而生,我们希望由 Egg.js 孕育出更多上层框架,帮助开发团队和开发人员降低开发和维护成本。详细的了解可以参考Egg.js的官网:https://eggjs.org/zh-cn/intro/ 。 Egg.js 奉行『约定优于配置』,按照一套 ...
1.创建 mysql 表结构 create database egg_article; use egg_article; create table article( id int(10) not null auto_increment, img text default ...
egg.js in action fullstack https://github.com/eggjs/egg/ cli config router service midlewares HTTP CURD async / await template ...
一、Egg简介绍 Express和Koa缺少约定,缺少规范,Eggjs对MVA进行约定规范,为企业框架而生。 特性: 基于Egg定制上层框架。 高度可扩展插件机制。 内置多进程管理。对比Nodejs。 框架稳定,测试覆盖率高。 渐进式开发。模块——》插件——》框架的演变。 Egg ...