Home > Software design >  Is it possible to check the id exists from one service to another in apollo-server with graphql?
Is it possible to check the id exists from one service to another in apollo-server with graphql?

Time:07-27

I am stuck in the following problem, has anyone faced the same?

I have got two services using apollo-server with graphql using mongodb:

  1. Group service
  2. User service


Group service contains “users” which will be resolved from User service.
 Need to pass user while creating group, is it possible to check whether that user exist or not in User service before creating group in Group Service?
or any other way?

CodePudding user response:

If each micro-service has its own mongo database, I would recommend storing a users in the Group service as well. It does not need to have all the user information (in fact it probably should not), just the ID would be sufficient.

Otherwise the solution would be to call the Users micro-service from the Ground micro-service, although ideally micro-services should not rely on each other.

  • Related