分阶段创建你的互联网 Web 产品
- 计划 📋
- 设计 ✂️
- 编码 ⚙
- 部署 🖥
被删减章节请搜索 NodeLover 微信公众号进行阅读。
📒《Node.js实战:使用 Egg.js + Vue.js + Docker 构建渐进式、可持续集成与交付应用》 源码
分阶段创建你的互联网 Web 产品
被删减章节请搜索 NodeLover 微信公众号进行阅读。
{ YAMLException: cannot resolve a node with !<tag:yaml.org,2002:js/function> explicit tag at line 15, column 5:
function validator(ctx) {
^
at generateError (/Users/kepeilin/Documents/web-projects/diao/node_modules/[email protected]@js-yaml/lib/js-yaml/loader.js:165:10)
at throwError (/Users/kepeilin/Documents/web-projects/diao/node_modules/[email protected]@js-yaml/lib/js-yaml/loader.js:171:9)
at composeNode (/Users/kepeilin/Documents/web-projects/diao/node_modules/[email protected]@js-yaml/lib/js-yaml/loader.js:1393:9)
at readBlockMapping (/Users/kepeilin/Documents/web-projects/diao/node_modules/[email protected]@js-yaml/lib/js-yaml/loader.js:1062:11)
at composeNode (/Users/kepeilin/Documents/web-projects/diao/node_modules/[email protected]@js-yaml/lib/js-yaml/loader.js:1332:12)
at readBlockSequence (/Users/kepeilin/Documents/web-projects/diao/node_modules/[email protected]@js-yaml/lib/js-yaml/loader.js:928:5)
at composeNode (/Users/kepeilin/Documents/web-projects/diao/node_modules/[email protected]@js-yaml/lib/js-yaml/loader.js:1331:12)
at readBlockMapping (/Users/kepeilin/Documents/web-projects/diao/node_modules/[email protected]@js-yaml/lib/js-yaml/loader.js:1062:11)
at composeNode (/Users/kepeilin/Documents/web-projects/diao/node_modules/[email protected]@js-yaml/lib/js-yaml/loader.js:1332:12)
at readDocument (/Users/kepeilin/Documents/web-projects/diao/node_modules/[email protected]@js-yaml/lib/js-yaml/loader.js:1492:3)
at loadDocuments (/Users/kepeilin/Documents/web-projects/diao/node_modules/[email protected]@js-yaml/lib/js-yaml/loader.js:1548:5)
at load (/Users/kepeilin/Documents/web-projects/diao/node_modules/[email protected]@js-yaml/lib/js-yaml/loader.js:1569:19)
at /Users/kepeilin/Documents/web-projects/diao/node_modules/[email protected]@ramda/src/internal/_pipe.js:3:14
at /Users/kepeilin/Documents/web-projects/diao/node_modules/[email protected]@ramda/src/internal/_arity.js:10:19
at /Users/kepeilin/Documents/web-projects/diao/node_modules/[email protected]@ramda/src/cond.js:47:30
at /Users/kepeilin/Documents/web-projects/diao/node_modules/[email protected]@ramda/src/internal/_arity.js:10:19
at R.tryCatch.path (/Users/kepeilin/Documents/web-projects/diao/node_modules/[email protected]@egg-y-validator/app/extend/context.js:61:23)
at /Users/kepeilin/Documents/web-projects/diao/node_modules/[email protected]@ramda/src/tryCatch.js:33:20
at /Users/kepeilin/Documents/web-projects/diao/node_modules/[email protected]@ramda/src/internal/_arity.js:10:19
at Array.forEach (<anonymous>)
at Object.loadDocs (/Users/kepeilin/Documents/web-projects/diao/node_modules/[email protected]@egg-y-validator/app/extend/context.js:70:11)
at Object.get docs [as docs] (/Users/kepeilin/Documents/web-projects/diao/node_modules/[email protected]@egg-y-validator/app/extend/context.js:75:17)
resolve({ code: 0, msg: 'success' })
然而源码都是 faliure
faliure => failure
错误:
- 在 example 下启动客户端
node clinet.js
clinet
拼接错误 --> client
刚刚入手,没有设计章节看的真的没头没尾的。。。对于整个应用读者不知道整体架构,即使一块块代码告诉我这个是什么功能,也读的很云里雾里啊。。抓不到重点。这本书的介绍不就是以实现一个类Dribble应用为核心吗,全书不是应该围绕这个主题的来叙述吗,然后穿插一些原理工具之类的。。没了这些章节,我身为一个读者的感受就是没头没尾,代码太多不知所云。。
对于一些不知道这个章节被删了的读者,可能就弃书了,读起来感觉真的不太好。。要不是我在cnode社区里看到您的评论说这些章节被删了,还真不知道
最后,感谢您的付出,以上是身为读者的一点感受,不当之处请见谅
那么多chapter没有描述不太好跳过章节挑着看
大佬 你这身体咋样了?羽化了吗?
修改好的路由代码,和测试用例代码,在下面,直接测试没法测试 redirect 后的 session。
图 3-1 下面的,数据并发
-> 数据并非
命令需要增加 attributes
参数。
sequelize model:generate --name User --attributes 'name:string'
因为时区原因,默认存储的 type 是 Date,比如 created_at,updated_at 总是跟实际差八小时。
排除docker安装 mysql 有时区问题后,
最后发现要在 sequelize 的配置项中加 timezone: '+08:00'
// config.default.js
config.sequelize = {
dialect: 'mysql',
database: 'XX',
host: 'XXXXX',
port: 'XX',
username: 'XX',
password: 'XX',
timezone: '+08:00'
}
默认是 latin 1,不支持中文,
改mysql的编码为 utf-8解决,请问如何在创建表的时候修改默认编码呢?
另外请教,如果mysql已经建表了,发现字段需要增加,是在migrations目录中新建一个js,然后执行 npx sequelize db:migrate 吗?
还是要先回退版本?
书中关于 sequelize 的教程偏少,看了你推荐的视频教程是付费的,暂无打算付费。
以上
async signUp() {
const { ctx } = this
await ctx.verify('user.signup', 'body')
const { user } = await ctx.service.user.signUp()
const ok = await this.ctx.service.user.sendVerifyEmail(
'激活邮箱',
user,
this.signUpTemplate.bind(this)
)
this.ok(ok)
}
报错,
Error: Cannot configure a schema with no rules
at Schema.define (F:\code\study\nodejs-shizhan\chapter3\5-6\miao\node_modules\async-validator\lib\index.js:46:13)
at new Schema (F:\code\study\nodejs-shizhan\chapter3\5-6\miao\node_modules\async-validator\lib\index.js:34:8)
at Object.[egg-y-validator:getValidator] (F:\code\study\nodejs-shizhan\chapter3\5-6\miao\node_modules\egg-y-validator\app\extend\context.js:135:23)
at Object.verify (F:\code\study\nodejs-shizhan\chapter3\5-6\miao\node_modules\egg-y-validator\app\extend\context.js:141:44)
at User.signUp (F:\code\study\nodejs-shizhan\chapter3\5-6\miao\app\controller\user.js:37:15)
at Object.callFn (F:\code\study\nodejs-shizhan\chapter3\5-6\miao\node_modules\egg-core\lib\utils\index.js:46:21)
at Object.classControllerMiddleware (F:\code\study\nodejs-shizhan\chapter3\5-6\miao\node_modules\egg-core\lib\loader\mixin\controller.js:87:20)
at Object.callFn (F:\code\study\nodejs-shizhan\chapter3\5-6\miao\node_modules\egg-core\lib\utils\index.js:46:21)
at wrappedController (F:\code\study\nodejs-shizhan\chapter3\5-6\miao\node_modules\egg-core\lib\utils\router.js:322:18)
at dispatch (F:\code\study\nodejs-shizhan\chapter3\5-6\miao\node_modules\koa-router\node_modules\koa-compose\index.js:44:32)
at next (F:\code\study\nodejs-shizhan\chapter3\5-6\miao\node_modules\koa-router\node_modules\koa-compose\index.js:45:18)
at F:\code\study\nodejs-shizhan\chapter3\5-6\miao\node_modules\koa-router\lib\router.js:346:16
at dispatch (F:\code\study\nodejs-shizhan\chapter3\5-6\miao\node_modules\koa-router\node_modules\koa-compose\index.js:44:32)
at F:\code\study\nodejs-shizhan\chapter3\5-6\miao\node_modules\koa-router\node_modules\koa-compose\index.js:36:12
at dispatch (F:\code\study\nodejs-shizhan\chapter3\5-6\miao\node_modules\koa-router\lib\router.js:351:31)
at dispatch (F:\code\study\nodejs-shizhan\chapter3\5-6\miao\node_modules\koa-compose\index.js:42:32)
at passportSession (F:\code\study\nodejs-shizhan\chapter3\5-6\miao\node_modules\egg-passport\lib\framework.js:59:12)
at dispatch (F:\code\study\nodejs-shizhan\chapter3\5-6\miao\node_modules\koa-compose\index.js:42:32)
at passportInitialize (F:\code\study\nodejs-shizhan\chapter3\5-6\miao\node_modules\egg-passport\lib\framework.js:36:12)
at dispatch (F:\code\study\nodejs-shizhan\chapter3\5-6\miao\node_modules\koa-compose\index.js:42:32)
at F:\code\study\nodejs-shizhan\chapter3\5-6\miao\node_modules\egg-y-validator\app\middleware\validator.js:15:15
at dispatch (F:\code\study\nodejs-shizhan\chapter3\5-6\miao\node_modules\koa-compose\index.js:42:32)
signup 这个函数内找不到ctx 上挂载的verify 是哪一步添加的啊 在书上没找到
p77 3.4.1 第二个段落
而且把大对象加入全局对象上会发生内存泄漏,需要谨慎而行。
为何内存泄漏受这个影响?内存泄漏不是因为程序不严谨或者 GC 没做好吗?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.