Skip to content

⏳ Timer API server is a demo Golang project that implements RESTful APIs and gRPC APIs for managing RESTful resource Timer.

License

Notifications You must be signed in to change notification settings

josephzxy/timer_apiserver

Repository files navigation

⏳ Timer API Server

codecov CircleCI Go Report Card GitHub go.mod Go version of a Go module

Timer API Server is a demo Golang project that implements RESTful APIs and gRPC APIs for Timer.

Major Tech stacks: Golang, Gin, gRPC, MariaDB, GORM, Cobra, Pflag, Viper, Docker, GNU Make

Try It Out!

  1. Check prerequisites
  1. Check out the repository to your local machine and go to the project root directory.

    git clone git@github.com:josephzxy/timer_apiserver.git
    cd timer_apiserver
  2. Build & launch with docker-compose

    make docker.compose.up
  3. Try out RESTful APIs & gRPC APIs

    # Create a timer named "hello"
    make demo.rest.post.hello
    
    # Display current content in the table
    make demo.db.show
    
    # Get the timer named "hello"
    make demo.rest.get.hello
    # Get all timers
    make demo.rest.get.all
    
    # Update the timer named "hello" to a new name "hello_again"
    make demo.rest.put.hello DEMO_REST_PUT_NAME=hello_again
    
    # Get all pending timers
    # Timers are pending if they are not deleted and not triggered yet
    make demo.grpc.getallpending
    
    # Delete the timer named "hello_again"
    make demo.rest.delete.hello_again

Overview

System overview

Timer API Server is a demo Golang project that implements RESTful APIs and gRPC APIs for Timer.

  • Loose-coupling design where high-level pluggable controllers(e.g. REST API Server) share layered low-level resource managing service(e.g. MySQL middleware).
  • Aligned with 12-factor-app methodology with supports for taking configurations from various sources, treating logs as event streams, launching the app as stateless processes, etc.
  • Achieved 95% test coverage on CodeCov and A+ on Go Report Card. Leverages GNU Make to automate trivial tasks. Lints, tests, and builds on each commit with CircleCI. Adapted Angular-style Git commit message and Gitflow workflow.
  • Enabled automated building and serving with Docker Compose.
  • Enabled auto-generation of RESTful API Swagger documentation.

API Doc

  • RESTful API

    View swagger doc as a webpage by

    make swagger

    Or check out swagger.yml directly.

  • gRPC API

    Please check out timer.proto.

Dev Doc

See Development Documentation.

About

⏳ Timer API server is a demo Golang project that implements RESTful APIs and gRPC APIs for managing RESTful resource Timer.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published