Giter VIP home page Giter VIP logo

simple-demo's Introduction

simple-demo

抖音项目服务端简单示例

接口信息链接

工程无其他依赖,直接编译运行即可

go build && ./simple-demo

TODO

  • 增加log功能
  • 反复判定err的代码过于冗余,待优化

功能说明

仅支持mysql作为数据库,配置参数在config/config.go中修改

  • Register: 新用户注册
  • Login: 用户登录,每次登录重新生成唯一token
  • Publish: 发布视频,接收文件默认存在./public下,返回用户发布视频列表
  • Feed: 推送视频,按提交时间返回该时间之前的视频,若无满足条件视频返回发布最早的视频
  • Favorite: 点赞视频,返回用户喜欢视频列表
  • Comment: 发布视频评论,返回视频评论列表,不支持对评论进行评论
  • Relation: 关注用户,返回用户关注列表,粉丝列表
  • Message: 发送消息,返回消息列表

测试

仅支持功能性测试,不支持并发量测试

通过以下命令行执行测试(依赖test包)

cd test
go test common.go [test_file.go]

test 目录下为不同场景的功能测试case,可用于验证功能实现正确性

其中 common.go 中的 serverAddr 为服务部署的地址,默认为本机地址,可以根据实际情况修改

测试数据写在 demo_data.go 中,用于列表接口的 mock 测试

simple-demo's People

Contributors

terryw-tx avatar raymondcode avatar

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.