Skip to content

Commit 38eb71f

Browse files
author
19983467897
committed
init commit
0 parents  commit 38eb71f

File tree

472 files changed

+76466
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

472 files changed

+76466
-0
lines changed

.DS_Store

6 KB
Binary file not shown.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Mr Zhang
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# 小张的个人博客
2+
3+
[博客前台在线预览地址](http://mrzym.top)
4+
5+
[博客后台在线预览地址](http://mrzym.top/admin)
6+
7+
第一个稳定版本的代码,陆陆续续开发了也快一年了,从我在B站发视频分享开始,我也根据大家的建议开发了一些新的功能,解决了能发现的一些bug,也踩了很多博客部署的坑,跟着我的部署教程来,你一定能学到前后端分离他是如何将前端与后端的交互联系起来、前端项目到底是以什么样的姿态部署在服务器上的。
8+
博客也使用了vue3、tailwind、element-plus、部分ts、vueUse等相对较新的技术框架,本人是一名前端开发,对于一些工作上会用到的开发思路、开发习惯在项目里也会体现到,大家可以试着去阅读一下一些页面的代码(大部分难点的注释也是比较多的),对以后的学习会有帮助的。
9+
10+
#### 介绍
11+
12+
前端主要技术:Vue3、ELement-Plus、Vue-router、Pinia、Tailwind.css、Sass、Animate.css
13+
14+
后端主要技术:Node.js、Koa、Koa-router、Seqlize、Mysql
15+
16+
此项目包括博客后台、前台的稳定版本代码,后续的开发不会在这上面改动
17+
如果有兴趣的小伙伴,可以自行开发
18+
评论管理的后台接口我是写好了的,有兴趣的小伙伴可以尝试写一下评论后台管理的增删改查页面,对一下接口。
19+
20+
#### 安装教程
21+
22+
每一个项目都有一个md文档 可以点进去看一看
23+
[博客部署教程](http://mrzym.top/#/article?id=6)
24+
25+
#### 使用说明
26+
27+
免费使用
28+
大家随意发挥
29+
30+
如果觉得这个项目还不错的话,可以打赏或捐赠作者,谢谢各位大哥赏饭吃,你的鼓励,是我最大的动力
31+
32+
作者还有在学习react next项目,感兴趣的话可以加群分享、帮忙答疑
33+
34+
<div style="display: flex">
35+
<img src="./alipay.png" height="60" width="60">
36+
<img src="./zhifupay.png" style="margin-left: 10px" height="60" width="60">
37+
</div>
38+
39+
<div style="margin-top: 20px">
40+
<div>博客群1(已满,可以试试能不能加进去,可能有退群的): 763111710</div>
41+
<div>博客群2: 939161701</div>
42+
</div>
43+

alipay.png

180 KB
Loading

blog-server/.DS_Store

6 KB
Binary file not shown.

blog-server/.env

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# node项目启动端口号
2+
APP_PORT = 8888
3+
# 数据库地址
4+
MYSQL_HOST = 127.0.0.1
5+
# 数据库端口号
6+
MYSQL_PORT = 3306
7+
# 数据库连接名
8+
MYSQL_USER = root
9+
# 数据库密码
10+
MYSQL_PASSWORD =
11+
# 数据库名称
12+
MYSQL_DB = online_blog
13+
# 超级管理员密码 超级管理员账户默认是admin 密码在这里自定义,然后通过管理员给你自己角色来获得修改权限
14+
ADMIN_PASSWORD = ''
15+
16+
# 七牛云 AK
17+
ACCESSKEY = ''
18+
# 七牛云 SK
19+
SECRETKEY = ''
20+
# 七牛云存储空间名称
21+
BUCKET = ''
22+
23+
# minio config 需要使用minio的就配置一下
24+
# minio AK
25+
MINIO_ACCESSKEY = ''
26+
27+
# minio SK
28+
MINIO_SECRETKEY = ''
29+
30+
# minio bucket
31+
MINIO_BUCKET = ''
32+
33+
# minio服务地址 直接写服务器地址 或者是网址就行 比如博主的就是 mrzym.top 不能带http://或者是https:// minio 会自动带
34+
MINIO_PATH = ''
35+
36+
# local本地 qiniu 七牛云 online 云服务器 minio minio服务器
37+
UPLOADTYPE = 'local'
38+
39+
# 服务器地址 用于拼接图片显示 可以使用七牛云测试域名 前面请带上http://或者https://根据实际情况带上
40+
# 本地就是 'http://127.0.0.1:8888/' 像使用了七牛云绑定了自己的二级域名 博主的图片域名 'http://img.mrzym.top/'
41+
# 具体如何设置二级域名 可以百度 七牛云文档也有教程 如果嫌麻烦 可以使用minio 只需要在自己的服务器上装一个就行 请看博客部署教程
42+
BASEURL = 'http://127.0.0.1:8888/'
43+
44+
# JWT密钥
45+
JWT_SECRET = blog
46+

blog-server/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
secret
3+
.env

blog-server/README.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<p align="center">
2+
<a href="http://39.108.51.116/#/login" target="_blank" rel="noopener noreferrer">
3+
<img width="180" src="https://img.shields.io/badge/%E5%B0%8F%E5%BC%A0%E7%9A%84%E5%8D%9A%E5%AE%A2%E5%90%8E%E7%AB%AF-v1.0.0-important" alt="Blog logo">
4+
</a>
5+
</p>
6+
7+
<p align="center">
8+
<img src="https://img.shields.io/badge/npm-v6.14.17-blue" alt="pnpm version">
9+
<a href="https://nodejs.org/en/about/releases/">
10+
<img src="https://img.shields.io/badge/node-v16.17.0-green" alt="node compatibility">
11+
</a>
12+
<a href="https://koa.bootcss.com/#">
13+
<img src="https://img.shields.io/badge/koa-v%5E2.7.0-blue" alt="koa">
14+
</a>
15+
<a href="https://github.com/brianmario/mysql2">
16+
<img src="https://img.shields.io/badge/mysql2-v%5E3.1.2-ff69b4" alt="mysql">
17+
</a>
18+
<a href="https://www.qiniu.com/">
19+
<img src="https://img.shields.io/badge/qiniu-v%5E7.8.0-blue" alt="qiniu">
20+
</a>
21+
<a href="https://www.sequelize.cn/">
22+
<img src="https://img.shields.io/badge/sequelize-v%5E6.29.0-orange" alt="sequelize">
23+
</a>
24+
<a href="https://www.npmjs.com/package/bcryptjs">
25+
<img src="https://img.shields.io/badge/bcryptjs-v%5E2.4.3-brightgreen" alt="bcryptjs">
26+
</a>
27+
</p>
28+
29+
## ⚡ 简介 introduction
30+
31+
一个前后端分离的个人博客项目 - 后端
32+
33+
已适配移动端、PC端,适合新手用于学习。
34+
35+
#### 前台
36+
37+
博客前台基于vue3、element plus、pinia、axios、vue-router、vue-cli、vue-use、npm、scss等主流技术
38+
39+
前台线上预览地址:<http://mrzym.top>
40+
41+
gitee仓库地址:<https://gitee.com/mrzym/blog-v3>
42+
43+
#### 管理后台
44+
45+
博客管理后台基于pureadmin、vue3、element plus、pinia、axios、vue-router、vue-use、pnpm、vite、sass、tailwindcss等主流技术
46+
47+
后台线上预览地址:<http://mrzym.top/admin>
48+
49+
gitee仓库地址: <https://gitee.com/mrzym/blog-v3-admin>
50+
51+
测试账户: test
52+
53+
密码: test123
54+
55+
也可以自行注册用户
56+
57+
#### 后端
58+
59+
博客后端基于node.js、koa、koa-router、koa-body、seqlize、mysql、qiniu(七牛云对象存储)、bcryptjs、nodemon等主流技术
60+
61+
gitee仓库地址:<https://gitee.com/mrzym/blogServer>
62+
63+
## 🚀 博客后端下载运行
64+
65+
因为后端是采用的node.js,所以不需要配置很多就能运行。
66+
67+
```git
68+
# npm 版本 v6.14.17
69+
# node 版本 v16 v18 都可以
70+
71+
1、下载项目
72+
git clone https://gitee.com/mrzym/blogServer.git
73+
tips: 也可以下载zip打开,这样不会和我的仓库关联,也可以自己去解除关联
74+
2、打开项目,安装依赖
75+
npm i
76+
3、数据库是mysql,需要先连接数据库
77+
应该大家都有mysql吧,没有就装一个,再装个navicat
78+
(1) 打开项目,在根目录下找到src文件夹下的db文件夹,里面有数据库的sql文件
79+
(2) 使用navicat创建一个空的数据库,运行这个sql文件,就可以生成表
80+
(3) 打开项目根目录下的.env文件,根据注释修改自己的mysql数据库账号名称、密码进行连接即可
81+
4、运行项目
82+
npm run serve
83+
84+
tips:.env文件下可以配置项目的上传文件方式,local为本地上传,qiniu为上传到七牛云存储,online为上传到自己的云服务器,使用其他的对象存储(七牛云、阿里云)是因为自己的服务器带宽不够,下载资源很慢,自己也可以先试一试online上传到自己的服务器,然后有经验了再去试一试七牛云。
85+
```
86+
87+
## 🌈部署
88+
89+
博客的部署教程
90+
91+
教程地址:<http://mrzym.top/#/articleList?id=2&type=category&name=%E5%8D%9A%E5%AE%A2%E9%83%A8%E7%BD%B2>
92+
93+
## 🥰感谢
94+
95+
感谢我所使用的这些技术框架的开发者、维护者,每一个框架、库的开发,都需要长时间的技术沉淀,充分的思考与不断地踩坑。维护开源库所需要花费的时间和精力更是常人所难以想象的。
96+
如果大家喜欢这个项目的话,麻烦大家点个star、fork,你们的鼓励是我最大的动力。

blog-server/app.js

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
* Module dependencies.
5+
*/
6+
7+
var app = require("./src/main.js")
8+
9+
10+
/**
11+
* Get port from environment and store in Express.
12+
*/
13+
const { APP_PORT } = require("./src/config/config.default.js")
14+
var port = normalizePort(APP_PORT || "3000")
15+
16+
17+
/**
18+
* Create HTTP server.
19+
*/
20+
21+
22+
/**
23+
* Listen on provided port, on all network interfaces.
24+
*/
25+
26+
app.listen(port, () => {
27+
console.log(`server is running on http://localhost:${APP_PORT || "3000"}`)
28+
})
29+
app.on("error", onError)
30+
app.on("listening", onListening)
31+
32+
/**
33+
* Normalize a port into a number, string, or false.
34+
*/
35+
36+
function normalizePort(val) {
37+
var port = parseInt(val, 10)
38+
39+
if (isNaN(port)) {
40+
// named pipe
41+
return val
42+
}
43+
44+
if (port >= 0) {
45+
// port number
46+
return port
47+
}
48+
49+
return false
50+
}
51+
52+
/**
53+
* Event listener for HTTP server "error" event.
54+
*/
55+
56+
function onError(error, ctx) {
57+
try {
58+
if (error.syscall !== "listen") {
59+
throw error
60+
}
61+
62+
var bind = typeof port === "string" ? "Pipe " + port : "Port " + port
63+
64+
// handle specific listen errors with friendly messages
65+
switch (error.code) {
66+
case "EACCES":
67+
console.error(bind + " requires elevated privileges")
68+
process.exit(1)
69+
break
70+
case "EADDRINUSE":
71+
console.error(bind + " is already in use")
72+
process.exit(1)
73+
break
74+
default:
75+
throw error
76+
}
77+
} catch (error) {
78+
console.error(error)
79+
}
80+
81+
82+
}
83+
84+
/**
85+
* Event listener for HTTP server "listening" event.
86+
*/
87+
88+
function onListening() {
89+
var addr = server.address()
90+
var bind = typeof addr === "string" ? "pipe " + addr : "port " + addr.port
91+
debug("Listening on " + bind)
92+
}

0 commit comments

Comments
 (0)