Questions Management – Frontend – Call the API Gateway

Check out the full series of Questions Management tutorial here.

We have built the API Gateway for Questions Management application, now is the time to edit the Frontend so that it only calls to the Microservice system of this application through the API Gateway.

There are 3 classes in the Frontend will call the API Category Service, API Question Service, API Option Service are CategoriesService, OptionsService, and QuestionsService. They are all located in the src/app/services directory. We will need to edit the context path (adding “/qm”) which will call the services in the methods of these classes as follows:

CategoriesService:

OptionsService:

QuestionsService:

Next, we need to modify the proxy.config.json file so that it only calls the API Gateway as follows:

Now, if you start using Questions Management application, you will see it work normally.

Đánh giá bài viết
Chia sẽ bài viết này ...Share on Facebook
Facebook
3Tweet about this on Twitter
Twitter
Share on LinkedIn
Linkedin

Add Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.