Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Golang in LINE MUSIC TW

Golang in LINE MUSIC TW

by Wei Wan @Golang Taipei Gathering #54 https://www.meetup.com/golang-taipei-meetup/events/272926722/

LINE Developers Taiwan

September 23, 2020
Tweet

More Decks by LINE Developers Taiwan

Other Decks in Technology

Transcript

  1. Who am I • Name: wei • Company: LINE Taiwan

    • Project: LINE MUSIC • School: NTUT • Interest: 看天之驕女
  2. Agenda • What is LINE MUSIC • System Architecture •

    APIGW Server • How to build RESTful API Server • How to build GraphQL Server • How to connect Other HTTP API • Content Server • How to build gRPC Server • How to connect MySQL • How to connect Redis • How to connect MongoDB • Event Log Server • How to connect Kafka • How to connect Elasticsearch • Content Sync Server • How to build WebSocket Server • Project Structure • Dependency Injection • Config Manage • Testing tools • Develop tools
  3. What is LINE MUSIC • LINE APP Profile BGM /

    RT / RBT • Share music to LINE APP • AIDJ • Recommendation
  4. How to build RESTful API Server (Gin) • Links •

    https://gin-gonic.com/zh-tw • https://github.com/gin-gonic/gin • Feature • Routing • Bind Path • Bind request body and validation • Custom Middleware
  5. How to build GraphQL Server (gqlgen) • Links • https://gqlgen.com/

    • https://github.com/99designs/gqlgen • Feature • CodeGen from GraphQL Schema (Model、Resolvers) • Intergration with Gin • Limit Query Complexity • APQ、Apollo Federation
  6. How to connect Other HTTP API (Resty) • Links •

    https://github.com/go-resty/resty • Feature • GET, POST, PUT, DELETE, HEAD, PATCH, OPTIONS • Request header, query, path param • Request body: string, []byte, struct, map, slice and io.Reader (Auto detects Content-Type) • Retry • Request and Response middlewares
  7. How to build gRPC Server (grpc-go) • Links • https://github.com/grpc/grpc-go

    • https://github.com/golang/protobuf/tree/master/protoc-gen-go • Feature • CodeGen from protobuf (Server、Client) • Health check • Retry • Interceptor
  8. How to connect MySQL (GORM) • Links • https://gorm.io/zh_CN •

    https://github.com/go-gorm/gorm • Feature • ORM • Preload • Hooks • Auto Migration
  9. How to connect Redis (go-redis) • Links • https://github.com/go-redis/redis •

    Feature • Single, Cluster • Operation • Pub / Sub