Skip to content

Commit 8d9edae

Browse files
committed
feat: update readme
1 parent 7168e91 commit 8d9edae

File tree

1 file changed

+151
-1
lines changed

1 file changed

+151
-1
lines changed

README.md

Lines changed: 151 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,152 @@
11
# NeighborBBS
2-
基于Golang开发的BBS
2+
3+
## 简介
4+
5+
NeighborBBS 是一款论坛项目,后端基于 Go 编写,前端基于 Vue 框架编写,前端页面参考了小码哥编写的[bbs-go](https://github.com/mlogclub/bbs-go),是本人的练手项目之一,适合用来学习和使用。
6+
7+
## 特性
8+
9+
- [x] 注册/登陆模块(用户名或邮箱登陆)
10+
- [x] 设置昵称、邮箱、用户名
11+
- [x] 发表动态、文章
12+
- [x] 评论系统
13+
- [x] 动态/文章的点赞
14+
- [x] 支持浏览器 token 记住登录
15+
- [x] 支持文章或评论流式获取
16+
- [x] 支持 markdown 语法发表文章或评论
17+
- [ ] 站内信
18+
- [ ] 用户资料编辑
19+
- [ ] 文章标签管理
20+
21+
## 技术选型
22+
23+
- 后端:整体使用 golang 编写,用 Gin 框架搭建 API 部分
24+
- 包管理:go-mod
25+
- 配置文件:使用 viper 实现的 yaml 格式的配置文件
26+
- 日志:基于 zap 实现的日志系统
27+
- 数据库:使用 mysql-5.7,采用 gorm 库来操作数据库
28+
- 前端:基于 Vue.js 编写,使用 Nuxt.js 快速构建和渲染前端
29+
30+
## 目录结构
31+
32+
```
33+
.
34+
├── LICENSE
35+
├── api (API文件夹)
36+
├── bbs.yaml (配置文件)
37+
├── build.sh (构建脚本,构建可在linux上运行的二进制文件)
38+
├── config (配置包)
39+
├── logs (日志包)
40+
├── main.go (main函数)
41+
├── middleware (中间件)
42+
├── model (结构体)
43+
├── nbbs.service (linux服务配置文件)
44+
├── repository (数据库层)
45+
├── service (服务层)
46+
├── util (通用工具)
47+
├── site (前端)
48+
│ ├── Dockerfile (docker文件)
49+
│ ├── app.html (app)
50+
│ ├── assets (静态文件)
51+
│ ├── common (通用工具)
52+
│ ├── components (通用组件)
53+
│ ├── jsconfig.json (配置)
54+
│ ├── layouts (布局)
55+
│ ├── middleware (中间件)
56+
│ ├── nuxt.config.js (nuxt配置)
57+
│ ├── pages (页面组件)
58+
│ ├── plugins (插件)
59+
│ ├── start.sh (运行脚本)
60+
│ ├── static (静态文件)
61+
│ ├── store (vuex状态管理仓)
62+
│ └── utils (通用工具)
63+
```
64+
65+
## 安装说明
66+
67+
### 1.获取源码
68+
69+
```shell
70+
git clone https://github.com/mlogclub/mlog.git
71+
```
72+
73+
### 2.创建 mysql 中的数据库
74+
75+
在 mysql 中创建好 database,在步骤 3 中填入 database 的信息,无需创建数据表
76+
77+
示例:
78+
79+
```shell
80+
ceate database neighborbbs;
81+
```
82+
83+
### 3.修改配置
84+
85+
修改 bbs.yaml 文件,配置 mysql、服务端口、日志等信息
86+
87+
示例:
88+
89+
```yaml
90+
mysql:
91+
host: 127.0.0.1
92+
port: 3306
93+
username: root
94+
password: 123456
95+
dbname: neighborbbs
96+
```
97+
98+
### 4.启动后端
99+
100+
> 如果没有 go 环境,请先安装和配置 go 环境
101+
102+
####安装依赖
103+
104+
```shell
105+
go mod download
106+
```
107+
108+
#### 启动服务
109+
110+
**方式一**
111+
112+
```shell
113+
go run main.go
114+
```
115+
116+
**方式二**
117+
118+
```shell
119+
go build #编译项目
120+
./NeighborBBS #执行二进制
121+
```
122+
123+
**方式三**
124+
125+
```shell
126+
./build.sh #编译成linux可执行文件
127+
#上传到linux服务器运行
128+
```
129+
130+
### 5.启动前端
131+
132+
> 如果没有 npm 环境,请先安装 npm 环境
133+
134+
#### (1) 进入 site 目录下
135+
136+
```shell
137+
cd site
138+
```
139+
140+
####(2) 在 nuxt.config.js 文件中配置启动端口等信息(可选项)
141+
142+
#### (3)安装依赖
143+
144+
```shell
145+
npm install
146+
```
147+
148+
#### (4)启动前端服务
149+
150+
```shell
151+
npm run dev
152+
```

0 commit comments

Comments
 (0)