![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
egg
xmh_1997
这个作者很懒,什么都没留下…
展开
-
egg mysql记录备用
config.sequelize = {dialect: ‘mysql’, // 表示使用mysqlhost: ‘127.0.0.1’, // 连接的数据库主机地址port: 3306, // mysql服务端口database: ‘test’, // 数据库名username: ‘root’, // 数据库用户名password: ‘123456’, // 数据库密码define: { // model的全局配置timestamps: true, // 添加create,update,de原创 2022-06-11 12:32:15 · 224 阅读 · 1 评论 -
egg + mongoose RESTful api设计实例
安装egg mongoosenpm init egg --type=simplenpm i npm init egg-mongoose npm run dev配置mongoose/config/plugin.js mogoose: { enable: true, package: 'egg-mongoose', }/config/config.default.js config.mongoose = { url: 'mongodb://localhost:原创 2022-02-26 23:55:06 · 436 阅读 · 0 评论 -
egg redis排行榜实现(node.js实战)
需求例子来源:https://blog.csdn.net/m0_37459380/article/details/82971525前段时间,做了一个世界杯竞猜积分排行榜。对世界杯64场球赛胜负平进行猜测,猜对+1分,错误+0分,一人一场只能猜一次。1.展示前一百名列表。2.展示个人排名(如:张三,您当前的排名106579)。分析一开始打算直接使用mysql数据库来做,遇到一个问题,每个人的分数都会变化,如何能够获取到个人的排名呢?数据库可以通过分数进行row_num排序,但是这个方法需要进行全表原创 2022-02-18 18:09:19 · 1072 阅读 · 1 评论 -
egg mongoose 学习记录
mongoose 安装npm init egg-mongoose --type=simpleconfig/plugin.jsmogoose: { enable: true, package: 'egg-mongoose',}config/config.default.jsconfig.mongoose = { url: 'mongodb://localhost:27017/runoob', option: { server: { poolSize: 40,原创 2022-02-16 15:31:14 · 383 阅读 · 0 评论 -
egg mysql sequelize学习
安装npm install egg-sequelize mysql2插件配置// config/plugin.js sequelize: { enable: true, package: 'egg-sequelize', },数据库配置// config/config.default.js config.sequelize = { dialect: 'mysql', // 表示使用mysql host: '127.0.0.1', // 连接的数据库主原创 2022-02-12 16:51:55 · 245 阅读 · 0 评论 -
egg restful api学习记录
egg 安装npm init egg --type=simplenpm iegg-mysql安装npm i --save egg-mysql// 开启插件// config/plugin.js mysql: { enable: true, package: 'egg-mysql', } // config/config.default.js config.mysql = { // 单数据库信息配置 client: { // host原创 2022-02-10 17:05:44 · 605 阅读 · 0 评论 -
egg定时器
egg定时器app/schedule/file// 写法一'use strict';const Subscription = require('egg').Subscription;let i = 0;class WatchFile extends Subscription { // 通过 schedule 属性来设置定时任务的执行间隔等配置 static get schedule() { return { interval: '5s', // 2s 间隔原创 2021-07-17 16:42:54 · 552 阅读 · 0 评论 -
egg view模板配置
egg view 模板配置/plugin.js ejs: { enable: true, package: 'egg-view-ejs', },/config.default.js config.view = { mapping: { '.html': 'ejs', }, };原创 2021-07-13 17:51:28 · 297 阅读 · 0 评论 -
egg框架学习文档(备忘录)
文章目录一、egg 安装启动二、HTTP常用的四种请求方式(router)1.GET ===> 获取数据。2.POST ===> 提交数据。3.PUT ===> 修改数据。4.DELETE ===> 删除数据。三、controller层里面的常用语法1.koa如何获取get传值2.koa获取动态路由3.csrf防范机制解决办法4.扩展工具在controller里面调用规则总结一、egg 安装启动npm init egg --type=simplen原创 2021-06-29 17:09:43 · 366 阅读 · 0 评论