0

I am following micro service architecture for develop react application. There are multiple projects of react and link in one main react application using npm link. which works successfully.

Web api is developed in Asp.net core. The concept is here is api and react app is in one project and we link it our main application of react. This gives benefit that our api and font code is at one place.

For example : E commerce website Main application is in react. Product module/ Order module/ Payment module are micro service which are in different projects. There all are connect using npm link in main React application. But my question is how to share data between micro service ?

I want to share user data/login info between other application. Generally we use context api for pass data to component but How this will be possible if all component in different react application?

Also there any other way to archive this in web-API in asp.net core ?

Kiya
  • 168
  • 1
  • 17
  • You could have put global data in composing react application store and make other application as isolated [subapps](https://redux.js.org/recipes/isolating-redux-sub-apps). Just throwing ideas. – tarzen chugh Jul 26 '19 at 08:52
  • so there will be different app that only deal with data and access in all application ? – Kiya Jul 26 '19 at 08:56
  • There will already be a container app that will render other react applications and deal with data and access. Container application would have global store and rest would be isolated sub-apps. – tarzen chugh Jul 26 '19 at 08:59
  • That is i have already done but suppose I do login to my Container application and have one token/userid. then how to pass this token/userid to sub application. How to manage user state. – Kiya Jul 26 '19 at 09:20
  • what about identity server with react for mirco microservices ? any one has explored it? – Kiya Jul 26 '19 at 12:15
  • may I know why it is down voted ? – Kiya Jul 30 '19 at 07:11

1 Answers1

2

Use redis/memcached to store user login session and call this from different microservices. Also you can club it with JWT with oauth and openid

Gourab Paul
  • 575
  • 7
  • 14