Categorygithub.com/answer-map/answer-service
modulepackage
0.0.3
Repository: https://github.com/answer-map/answer-service.git
Documentation: pkg.go.dev

# README

answer-service

answer-map REST web service

Setting up a local database and service

  • Run docker compose up.
  • Run psql -d postgres -U user1 -a -f .\sql\create_schema.sql. May need to install psql.
  • Enter password: pass1.
  • The service will be available on port 8080.
  • answer-map.postman_collection.json can be imported to connect to your local instance on 8080

Additional questions:

  1. How would you support multiple users?
    • there is an answer_user table with a primary key to identify each answer_user (user_id)
    • this user_id can be referenced in the answer_map table and with a unique constraint to make each answer_map unique to the user_id and answer_key
  2. How would you support answers with types other than string?
    • Suppose that the answer value type is not known, then we can avoid decoding it from json by defining it as AnswerValue *json.RawMessage in the AnswerMap struct. That raw message can be marshalled into a byte array before being stored as a byte array in the database.
  3. What are the main bottlenecks of your solution?
    • one replica of the docker image that runs the service
    • uses a sql docker image with limited resources (no volumes, small storage, not load-balanced)
  4. How would you scale the service to cope with thousands of requests?
    • deploy more replicas of the docker image that runs the service and use a load-balancer
    • use a datasource that can autoscale resources

# Packages

No description provided by the author
No description provided by the author
Package mock_service is a generated GoMock package.
No description provided by the author
No description provided by the author