alvin0216 / react-blog Goto Github PK
View Code? Open in Web Editor NEWreact hooks + koa2 + sequelize + mysql 构建的个人博客。具备评论、通知、上传文章等等功能
License: MIT License
react hooks + koa2 + sequelize + mysql 构建的个人博客。具备评论、通知、上传文章等等功能
License: MIT License
最近在报错 hljs is not defined 能处理这个问题吗?
好像是CDN失效了
请问,两个模型直接如何进行关联
{
stack: "SequelizeDatabaseError: Unknown column 'tags.articleId' in 'on clause' at Query.formatError (F:\github\react-blog\server\node_modules\sequelize\lib\dialects\mysql\query.js:244:16) at Query.handler [as onResult] (F:\github\react-blog\server\node_modules\sequelize\lib\dialects\mysql\query.js:51:23) at Query.execute (F:\github\react-blog\server\node_modules\mysql2\lib\commands\command.js:30:14) at Connection.handlePacket (F:\github\react-blog\server\node_modules\mysql2\lib\connection.js:408:32) at PacketParser.Connection.packetParser.p [as onPacket] (F:\github\react-blog\server\node_modules\mysql2\lib\connection.js:70:12) at PacketParser.executeStart (F:\github\react-blog\server\node_modules\mysql2\lib\packet_parser.js:75:16) at Socket.Connection.stream.on.data (F:\github\react-blog\server\node_modules\mysql2\lib\connection.js:77:25) at emitOne (events.js:115:13) at Socket.emit (events.js:210:7) at addChunk (_stream_readable.js:266:12) at readableAddChunk (_stream_readable.js:253:11) at Socket.Readable.push (_stream_readable.js:211:10) at TCP.onread (net.js:587:20) From previous event: at Query.run (F:\github\react-blog\server\node_modules\sequelize\lib\dialects\mysql\query.js:39:12) at runHooks.then.then (F:\github\react-blog\server\node_modules\sequelize\lib\sequelize.js:645:29) From previous event: at Promise.try.then.connection (F:\github\react-blog\server\node_modules\sequelize\lib\sequelize.js:645:12) From previous event: at Promise.resolve.retry (F:\github\react-blog\server\node_modules\sequelize\lib\sequelize.js:641:10) at F:\github\react-blog\server\node_modules\retry-as-promised\index.js:70:21 at Promise () at retryAsPromised (F:\github\react-blog\server\node_modules\retry-as-promised\index.js:60:10) at Promise.try (F:\github\react-blog\server\node_modules\sequelize\lib\sequelize.js:631:30) From previous event: at Sequelize.query (F:\github\react-blog\server\node_modules\sequelize\lib\sequelize.js:580:23) at QueryInterface.rawSelect (F:\github\react-blog\server\node_modules\sequelize\lib\query-interface.js:1163:27) at Function.aggregate (F:\github\react-blog\server\node_modules\sequelize\lib\model.js:1993:32) at Promise.try.then (F:\github\react-blog\server\node_modules\sequelize\lib\model.js:2045:19) at runCallback (timers.js:781:20) at tryOnImmediate (timers.js:743:5) at processImmediate [as _immediateCallback] (timers.js:714:5) From previous event: at Function.count (F:\github\react-blog\server\node_modules\sequelize\lib\model.js:2029:8) at Function.findAndCountAll (F:\github\react-blog\server\node_modules\sequelize\lib\model.js:2097:12) at getList (F:\github\react-blog\server\controllers\article.js:129:39) at dispatch (F:\github\react-blog\server\node_modules\koa-compose\index.js:44:32) at next (F:\github\react-blog\server\node_modules\koa-compose\index.js:45:18) at F:\github\react-blog\server\node_modules\koa-router\lib\router.js:346:16 at dispatch (F:\github\react-blog\server\node_modules\koa-compose\index.js:44:32) at F:\github\react-blog\server\node_modules\koa-compose\index.js:36:12 at dispatch (F:\github\react-blog\server\node_modules\koa-router\lib\router.js:351:31) at dispatch (F:\github\react-blog\server\node_modules\koa\node_modules\koa-compose\index.js:42:32) at logger (F:\github\react-blog\server\node_modules\koa-logger\index.js:67:13) at dispatch (F:\github\react-blog\server\node_modules\koa\node_modules\koa-compose\index.js:42:32) at module.exports (F:\github\react-blog\server\middlewares\authHandler.js:56:11) at dispatch (F:\github\react-blog\server\node_modules\koa\node_modules\koa-compose\index.js:42:32) at jsonError (F:\github\react-blog\server\node_modules\koa-json-error\lib\middleware.js:49:12) at dispatch (F:\github\react-blog\server\node_modules\koa\node_modules\koa-compose\index.js:42:32) at F:\github\react-blog\server\node_modules\koa-body\index.js:148:14 at at process._tickCallback (internal/process/next_tick.js:188:7)",
name: "SequelizeDatabaseError",
parent: {
code: "ER_BAD_FIELD_ERROR",
errno: 1054,
sqlState: "42S22",
sqlMessage: "Unknown column 'tags.articleId' in 'on clause'",
sql: "SELECT count(DISTINCT(article
.id
)) AS count
FROM article
AS article
LEFT OUTER JOIN tag
AS tags
ON article
.id
= tags
.articleId
LEFT OUTER JOIN category
AS categories
ON article
.id
= categories
.articleId
LEFT OUTER JOIN comment
AS comments
ON article
.id
= comments
.articleId
LEFT OUTER JOIN reply
AS comments->replies
ON comments
.id
= comments->replies
.commentId
WHERE article
.id
!= -1 AND (article
.title
LIKE '%%' OR article
.content
LIKE '%%');"
},
original: {
code: "ER_BAD_FIELD_ERROR",
errno: 1054,
sqlState: "42S22",
sqlMessage: "Unknown column 'tags.articleId' in 'on clause'",
sql: "SELECT count(DISTINCT(article
.id
)) AS count
FROM article
AS article
LEFT OUTER JOIN tag
AS tags
ON article
.id
= tags
.articleId
LEFT OUTER JOIN category
AS categories
ON article
.id
= categories
.articleId
LEFT OUTER JOIN comment
AS comments
ON article
.id
= comments
.articleId
LEFT OUTER JOIN reply
AS comments->replies
ON comments
.id
= comments->replies
.commentId
WHERE article
.id
!= -1 AND (article
.title
LIKE '%%' OR article
.content
LIKE '%%');"
},
sql: "SELECT count(DISTINCT(article
.id
)) AS count
FROM article
AS article
LEFT OUTER JOIN tag
AS tags
ON article
.id
= tags
.articleId
LEFT OUTER JOIN category
AS categories
ON article
.id
= categories
.articleId
LEFT OUTER JOIN comment
AS comments
ON article
.id
= comments
.articleId
LEFT OUTER JOIN reply
AS comments->replies
ON comments
.id
= comments->replies
.commentId
WHERE article
.id
!= -1 AND (article
.title
LIKE '%%' OR article
.content
LIKE '%%');",
message: "Unknown column 'tags.articleId' in 'on clause'",
status: 500
}
例如: 用户按标签查询,输入关键字 Javascript
获取如下结果
[
{
createdAt: "2020-01-14 15:51:24",
updatedAt: "2020-04-13 14:35:55",
id: 87,
title: " React Hooks 笔记",
content: "content值",
viewCount: 66,
tags: [{name: "Javascript", name: "react"}],
categories: [{name: "Javascript"}],
comments: []
},
{
createdAt: "2020-01-14 15:51:24",
updatedAt: "2020-04-13 14:35:55",
id: 88,
title: " React Hooks 笔记1",
content: "content值",
viewCount: 66,
tags: [{name: "Javascript", name: "vue"}],
categories: [{name: "Javascript"}],
comments: []
}
]
const { tag_name } = ctx.query
.....
const data = await ArticleModel.findAndCountAll({
这个查询sql 该怎么写
})
看到你后面将react-scripts这个module拎出来了,不太懂为什么要这样做?
上古战士IE11显示空白
改为淘宝镜像后也没有解决,有没有遇到过一样情况的呢,是如何解决呢,求教!
请问,这个useMount自定义的hook的用处是什么,我水平不够,不知道有什么意义
`
import { useEffect } from 'react'
export default function useMount(func) {
useEffect(() => {
typeof func === 'function' && func()
}, [])
}
`
/**
请问在dynamic == true时filter有何意义?
研究源码,感觉就是不知从何处下手。大佬可以简单讲一下后台项目的思路吗?比如先写哪个模块,后写哪个模块。谢谢!
开个issue讨论一下,准备周末提个pr
你好 非常开心看到你的开源项目。我们团队最近在做一个和信息平台相关的项目(目前在北京和北美注册的公司)。我们正好缺具有react开发经验的小伙伴(可以通过多种方式加入,未必全职),如果你感兴趣加入我们,想进一步了解我们的团队。可以添加我的微信 SJHBXS
郭大大,数据库文件,没有找到,跟郭大大学习,
大佬,评论功能可以指导一下怎么做的吗
大佬,我也在写一个类似的项目,想使用rsa加密,在服务端解密好像有点问题,你有什么好推荐的插件不
大佬,能解答下,项目中svg文件的引入步骤吗,在配置中没有找到呢
打包后无法访问文章管理页面啊,刷新页面404,还有你这后台怎么部署?能说一下吗?新手
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.