1 Star 1 Fork 5

liggyi / Video

forked from Hank / go-Video 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSD-3-Clause

Video-go

介绍

Golang实现视频网站

开发步骤

  1. 一个简单例子SimpleWebApp实现测试相关

    1. 创建一个简单的web页面测试 go test -v

    2. t.SkipNow() 刚在测试函数的第一行跳过此测试并pass

    3. 分组测试 t.Run 和 初始化测试 TestMain

    4. 性能测试Benchmark 命令go test -bench=.

      测试性能的时候注意,要保持稳定状态,不然永远不会终止

      func f1()int{
      	if n>0{
          	n--
         	}
          return n
      }
      func BenchmarkAll(b *testing.B) {
      	for n := 0; n < b.N; n++ {
              f1() // 非稳定状态,永远不会跑完
      	}
      }
  2. REST设计风格的API json作为数据格式

    1. 用户相关
      1. 创建/注册用户(URL: /user 状态码:201,400,500)
      2. 登录用户(URL:/user/:username 状态码:200,400,500)
      3. 获取用户基本信息(URL:/user/:username 状态码:200,400,401,403,500)
      4. 用户注销(URL:/user/:username 状态码:204,400,401,403,500)
    2. 用户资源
      1. 所有资源(URL:/user/:username/videos 状态码:200,400,500)
      2. 获取一个资源(URL:/user/:username/videos/vid-id 状态码:200,400,500)
      3. 删除一个资源(URL:/user/:username/videos/vid-id 状态码:204,400,401,403,500)
    3. 评论相关
      1. 显示评论(URL:/videos/:vid-id/comments 状态码:200,400,500)
      2. 发送评论(URL:/videos/:vid-id/comments 状态码:201,400,500)
      3. 删除评论(URL:/videos/:vid-id/comment/comment-id 状态码:204,400,401,403,500)
  3. 数据库设计

    1. 创建users、video_info、comments、comments、sessions四个表,尽量不用外键关联,详见SQL文件
    2. 连接数据库dbops/conn.go
  4. 用户表完成并测试

  5. 视频表完成并测试

  6. 评论表完成并测试

  7. session与数据库交互和逻辑处理

  8. 中间件实现用户创建的API完成

  9. streamserver完成视频播放

  10. streamserver完成视频上传

  11. 调度器 scheduler

  12. 前端服务完成

BSD 3-Clause License Copyright (c) 2020, 韩小星星 All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

简介

Golang实现视频网站 展开 收起
Go
BSD-3-Clause
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Go
1
https://gitee.com/liggyi/Video-go.git
git@gitee.com:liggyi/Video-go.git
liggyi
Video-go
Video
master

搜索帮助