Code Monkey home page Code Monkey logo

my-blog-by-go's Introduction

使用go搭建一个简易的博客系统

  • 后端使用Go语言开发,使用Web框架gin和ORM框架xorm。
  • 前端使用React+Metrail-Ui+React-Router4。
  • 命令行工具使用github.com/urfave/cli开发。

目前功能

  • 命令行工具能对文章进行上传、删除、和进行请求Host进行配置。
  • 服务端提供了对于文章的基本增删改查接口,使用sqlite数据来存储文章相应的标题、标签和分类等。
  • 前端能简单展示文章列表和文章内容,根据标签或者分类展示相关的文章。

截图

展示图1

展示图2

展示图3

启动项目

  • 服务端
go get -u github.com/zachrey/my-blog-by-go

cd $GOPATH/src/github.com/zachrey/my-blog-by-go/

go run main.go

端口默认开启的是本地的8888

  • 前端
cd $GOPATH/src/github.com/zachrey/my-blog-by-go/front_web

yarn && yarn start
  • 命令行工具
cd $GOPATH/src/github.com/zachrey/my-blog-by-go/cmd

go run main.go --help

这里,前后端和命令行工具都没有进行编译,直接在开发环境中演示。

如果go 项目中有些依赖包下载不下来,建议翻墙或者去github找相应的库,然后将它clone到你的src/github文件夹相应路劲下。

项目结构

.
├── cmd // 命令行工具
├── controllers // 控制器
├── database // 数据库连接,配置等
├── front_web // react前端内容
├── models // 数据库相关表的操作模板
├── posts // 存放上传的文章
├── routers // 路由
├── static // 静态文件资源,前端打包后就可以打包放到这里面
├── gin.log // web运行日志
├── main.go // 程序入口
├── README.md
└── vendor

欢迎讨论和star

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.