Giter Site home page Giter Site logo

hash-generator-app's Introduction

How to play with this app?

  1. Run make build command
  2. Start a worker to refresh token every interval: ./bin/refresh_hash_worker
    • interval = 5 seconds by default. Provide HASH_GENERATION_INTERVAL env variable to change the value( example: HASH_GENERATION_INTERVAL=5m ./bin/refresh_hash_worker )
    • we use a file to save cache(just for PoC, better storage should be used in real project)
  3. Start HTTP API server: ./bin/http_api
    • default port is 8001
    • see possible env variables to configure HTTP server here: internal/config/config.go
  4. Hit http://localhost:8001/hash URL to test response.
    • response example: {"hash":"11cdc662-38b6-40b7-b79c-17d6d0bb1749","generated_at":"2023-03-20T13:50:24.503731+02:00"}
  5. Start GRPC API server: ./bin/grcp_api
    • default port is 8002
    • see possible env variables to configure GRPC server here: internal/config/config.go
  6. Run GRPC client: ./bin/grcp_client
    • You will see next logs with info about success connection/response {"level":"info","timestamp":"2023-03-20T14:13:18.303726+02:00","message":"Starting GRPC api client"} {"level":"info","timestamp":"2023-03-20T14:13:18.321008+02:00","message":"Uuid: f88e70cb-493a-486f-bba8-be7c63522360, Time: 2023-03-20 14:13:14.324162 +0200 EET"}
    • see GRPC client details here: cmd/grpc_client/main.go
  7. Check Makefile to see available commands(code test, checks, build, proto etc)

Mocking

Make sure you have "Gomock" installed:

`go get -u github.com/golang/mock/gomock`
`go install github.com/golang/mock/[email protected]`

Example of command to generate mock file:

`mockgen -source=./pkg/logger/logger.go -destination=./pkg/mock/logger.go -package=mock`

hash-generator-app's People

Contributors

iyhunko avatar serhiohalcyon avatar

Watchers

 avatar  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.