mikemintang
V2EX  ›  问与答

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

  •  
  •   mikemintang · Jan 11, 2018 · 1883 views
    This topic created in 3068 days ago, the information mentioned may be changed or developed.

    介绍

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

    项目截图

    gonews

    部署

    • 获取新闻数据
    git clone https://github.com/gocn/news /data/news
    
    • 获取源码
    go get -u github.com/mikemintang/gonews
    
    • 解析数据
    nohup gonews -d /data/news > /data/log/gonews.log 2>&1 
    
    • 启动 Api
    nohup gonews -a api -p 8017 > /data/log/gonews.log 2>&1 &
    
    • 前端部署
    cd $GOPATH/src/github.com/mikemintang/gonews/web
    npm install
    npm run build
    
    • Nginx 配置
    server {
        listen       80;
        server_name gonews.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;
        }
    
        location /news {
            rewrite         ^.+news/?(.*)$ /$1 break;
            proxy_pass      http://gonews.cc;
        }
    }
    
    • Shell 脚本
    #!/bin/sh
    
    cd /data/news
    git pull origin master
    
    • 定时任务
    crontab -e
    */1 * * * * /bin/sh /data/shell/cache_news.sh
    */2 * * * * nohup gonews -d /data/news/ > /data/log/gonews.log 2>&1
    

    用到的技术

    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

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2699 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 10:39 · PVG 18:39 · LAX 03:39 · JFK 06:39
    ♥ Do have faith in what you're doing.