gonews是基于go+vue实现的golang每日新闻浏览与检索平台

介绍

gonews是基于go+vue实现的golang每日新闻浏览与检索平台

项目截图

gonews

部署

  • 获取新闻数据
1
git clone https://github.com/gocn/news /data/news
  • 获取源码
1
go get -u github.com/mikemintang/gonews
  • 解析数据
1
nohup gonews -d /data/news > /data/log/gonews.log 2>&1
  • 启动Api
1
nohup gonews -a api -p 8017 > /data/log/gonews.log 2>&1 &
  • 前端部署
1
2
3
cd $GOPATH/src/github.com/mikemintang/gonews/web
npm install
npm run build
  • Nginx配置
1
2
3
4
5
6
7
8
9
10
11
server {
listen 80;
server_name gonews.idoubi.cc;
index index.html index.htm index.php;
root /data/go/src/mikemintang/gonews/web;

location /api {
rewrite ^.+api/?(.*)$ /$1 break;
proxy_pass http://127.0.0.1:8017;
}
}
  • Shell脚本
1
2
3
4
5
#!/bin/sh

cd /data/news
git pull origin master
nohup gonews -d /data/news/ > /data/log/gonews.log 2>&1
  • 定时任务
1
2
crontab -e
*/10 * * * * /bin/sh /data/shell/cache_news.sh

用到的技术

golang包

  • github.com/go-redis/redis
  • encoding/json
  • flag
  • net/http
  • net/url
  • strconv
  • sync
  • crypto/md5
  • fmt
  • io
  • io/ioutil
  • net/url
  • os
  • path/filepath
  • regexp
  • strconv
  • strings
  • time

npm包

  • vue
  • vuex
  • vue-router
  • axios
  • moment
  • mockjs

欢迎提交Pull Request

感谢您的阅读,本文由 任想科技 版权所有。如若转载,请注明出处:任想科技(https://idoustudio.com
SQL2Struct:一款根据sql语句自动生成golang结构体的chrome插件
douchat 4.0 新版发布,助力小程序后台开发