Microservices With Node Js And React Download Instant
api-gateway: build: ./api-gateway ports: - "5000:5000" depends_on: - user-service - product-service
function App() { const [users, setUsers] = useState([]); const [name, setName] = useState(''); const [email, setEmail] = useState(''); microservices with node js and react download
Run everything with:
const User = mongoose.model('User', userSchema); api-gateway: build:
Now the React app can make requests to http://localhost:5000/users instead of directly to each service. Sometimes services need to communicate without blocking the request-response cycle. Redis Pub/Sub is a lightweight solution. Example: When a user is created, notify the email service. In user-service (publisher): setUsers] = useState([])