react + typescript 博客内容管理系统

RyanCMS
项目地址 https://github.com/m-Ryan/RyanCMS
基于这个项目,你可以了解到

[x] 前后端分离的实践

[x] react如何搭配typeScript
– 例如编写基本的接口,枚举、泛型
– 例如使用第三方包如何编写d.ts

[x] react服务端渲染
– 如何通过nodejs中间层做服务端渲染
– 如何在服务端渲染时向redux注入数据
– 如何避免服务端已经调用的接口,在浏览器端重复调用

[x] 一种简单易用的redux模型
这样的redux模型你用过没

只要这样调用

[x] 装饰器的一些妙用

例如编写一个autobind 绑定react中的this
例如编写一个catchError 捕获错误
例如编写一个loading 设置加载状态等等

TODO

[ ] 主题切换
[ ] 自定义栏目
[ ] 一些优化

项目预览 http://cms.maocanhua.cn
项目预览博客 http://cms.maocanhua.cn/u/Ryan
如何使用
git clone git@github.com:m-Ryan/RyanCMS.git
在 backend下新建一个文件夹config,在下面新建 ormconfig.json

里面的内容大概是这样
{
“type”: “mysql”,
“host”: “localhost”,
“port”: 3306,
“username”: “root”,
“password”: “******”,
“database”: “cms”,
“entities”: [
“src/**/**.entity{.ts,.js}”
],
“synchronize”: true,
“cache”: true,
“logging”: false
}
首次使用请先安装依赖

切换到 backend,npm install 或者 yarn
切换到 fontend,npm install 或者 yarn

1.切换到 backend
yarn start => 本地开发
2.切换到 fontend
yarn start => 本地开发
打开 http://localhost:3000/ 即可预览

服务端渲染
3.切换到 backend
yarn start => 本地开发
4.切换到 fontend

yarn build => 编译前端代码
yarn server:start => 本地开发,使用nodejs中间层

打开 http://localhost:3100/ 即可预览
如果你喜欢或者对你有帮助,不妨给我个star或者fork一下吧❤️

部分页面

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理