0

Go Markdown 博客系统

 2 years ago
source link: https://studygolang.com/articles/35358
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Go Markdown 博客系统

Golang 练手项目

基于 Go 语言实现的 Markdown 博客系统

├── Makefile                     # 项目管理文件
├── conf                         # 配置文件统一存放目录
├── internal                     # 业务目录
│   ├── handler                  # http 接口
│   ├── pkg                      # 内部应用程序代码
│   └── routers                  # 业务路由
├── logs                         # 存放日志的目录
├── static                       # 存放静态文件的目录
├── tpl                          # 存放模板的目录
├── main.go                      # 项目入口文件
├── pkg                          # 公共的 package
├── tests                        # 单元测试
└── startup.sh                   # 启动脚本
  • 文章管理:文章增删改查
  • 页面管理:页面增删改查,可自定义 markdown 页面
  • 分类管理:分类增删改查
  • 标签管理:标签列表
  • 文章列表:倒序展示文章、可置顶
  • 内容页面:markdown 内容展示
  • 标签页面:按标签文章数量排序
  • 关于页面:个人说明
  • 阅读清单:个人阅读书籍
  • 站内搜索:支持文章标题、描述、内容、分类、标签模糊搜索

遵循: Uber Go 语言编码规范

  • make help 查看帮助
  • make dep 下载 Go 依赖包
  • make build 编译项目
  • make tar 打包文件
  • 依赖环境:

      • mysql
      • redis
      • elasticsearch
# 下载安装,可以不用是 GOPATH
git clone https://github.com/convee/goblog.git

# 进入到下载目录
cd goblog

# 生成环境配置文件
cd conf

# 修改 mysql、redis、elasticsearch 配置

# 导入初始化 sql 结构
mysql -u root -p
> create database blog;
> set names utf8mb4;
> use blog;
> source blog.sql;


# 下载依赖
make dep

# 编译
make build

# 运行
./goblog dev.yml

http://localhost:9091

http://localhost:9091/admin

用户名:[email protected]

密码:123456


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK