gonews是基于 go+vue 實現的golang每日新聞瀏覽與檢索平臺
項目地址: Github
線上Demo:GoNews
數據來源: GoCN每日新聞
項目截圖
部署
獲取新聞數據
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
|
#!/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包
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
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 |
總結
以上所述是小編給大家介紹的基于go+vue實現的golang每日新聞數據瀏覽與檢索平臺,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對服務器之家網站的支持!
原文鏈接:http://idoubi.cc/