1.GET 方法 // 商品详情 async detail() { const { ctx } = this; console.log(ctx.query); ctx.body = ...
.创建service文件 app service product.js const Service require egg .Service class ProductService extends Service async index return id: , name: 测试 module.exports ProductService .调用 async index const ctx t ...
2020-03-01 12:00 0 1491 推荐指数:
1.GET 方法 // 商品详情 async detail() { const { ctx } = this; console.log(ctx.query); ctx.body = ...
1.安装 ejs yarn add egg-view-ejs 2.修改配置 config/plugin.js 'use strict'; exports.ejs = { enable: true, package: 'egg ...
1.创建 mysql 表结构 create database egg_article; use egg_article; create table article( id int(10) not null auto_increment, img text default ...
1.开发文章首页接口 app/service/article.js const Service = require('egg').Service; class ArticleService extends Service { async lists() { const ...
1.创建 service 文件 app/service/article.js const Service = require('egg').Service; class ArticleService extends Service { async create(params ...
关于egg.js项目部署服务器的问题 我使用的是腾讯云centos , 部署前需要确保服务器上安装了mysql, node . mysql下载:https://dev.mysql.com/downloads/mysql/ 我使用的是红帽企业版Linux node下载:http ...
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 ...