Creating API gateway using loopback4 - node.js

How can I call my loopback4 api from another LB4 application?
Let me explain more,
I have created one lb4 application as microservice. I want to create gateway & want to call this lb4 microservice in lb4 gateway application . So for this, I have given target URL. As my microservice application runs on 3000 port & my gateway application runs on 8000 port.
Now I want to access all 3000 api endpoints with 8000 port that is by using gateway application. I have referred this for gateway creation https://loopback.io/doc/en/lb4/Integrating-with-api-connect.html. But it's not working.
Then, i tried to call rest api using openapi specification. I have followed Loopback4 - Call REST API with OpenAPI definition this link. All the endpoints are created in explorer but I am getting error as 'Not Implemented' after clicking on any api for getting response.
I hope I will get the solution here from experts!

Not sure how you are creating your gateway but does your gateway support patterns for example routes through Zuul can be configured with path: /myusers/myservice/** that means path starting with myusers/myservice and any path after this will be configured to routed to a service.Take a look at the following page for an example :-
https://cloud.spring.io/spring-cloud-netflix/multi/multi__router_and_filter_zuul.html

Related

AWS API Gateway Locally

I'm trying to build an api gateway for an app in development using aws. I followed the steps in the doc https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-create-api-step-by-step.html.
However when I set my endpoint to be 127.0.0.1:3000/users for example, it returns an 500 {"message": "Internal server error"}.
The app is a simple nodejs endpoint run in docker. I'm just trying to discover api gateways.
I'm guessing the error is that the endpoint that I provide is not valid because I'm using it locally. So is there a way to use aws api gateway locally and is it the best option for an api gateway.
The doc you mention doesn't describe any method for deploying and running an api gateway locally, nor am I aware of any method to do this. I'm only aware of running API Gateway in AWS. The problem may be that you are trying to hit an API Gateway endpoint on your local machine, which is not possible.
Perhaps I misunderstand and you're trying to integrate an API Gateway in AWS with a service running locally. If this is the case, API Gateway will not be able to have an integration endpoint on your local machine, unless you expose your machine to the public internet AND provide api gateway with a public internet address for your machine. 127.0.0.1 is not a public internet address.

How do requests from clients to an API get routed through the gateway hosted on Azure?

I'm not entirely new to MS Azure, but I am new to its API Management Service. I am trying to get an understanding of how the routing works between the client, the APIMS, and the backend APIs, but somehow can't seem to find what I'm looking for within Microsoft's documentation.
So here's what we have and what I understand:
We have multiple APIs that we host on Azure as App Services. And those APIs are added to the APIMS, which we are using as a gateway. The APIMS's Inbound policies on each API specifies the backend service as that App. But that's all I know.
So when a client, say an application running on someone's computer, sends a request to one of those APIs, how does its request URL end up routing through the gateway? And how does that all relate?
the request URL is made up as follows:
[name of your APIM service].azure-api.net/[name of api]/[api method]/[querystring]
example:
https://myapimanager.azure-api.net/myapi/getstudent?id=1
https://myapimanager.azure-api.net/myotherapi/getsomethingelse?name=bubbles

Is Google Cloud Endpoints equivalent to an API Gateway, or are Endpoints equivalent to a microservice?

Using the App Engine Flexible Environment, I'm preparing to deploy an Angular 4 client and am looking into Cloud Endpoints to handle my node.js/express microservices as it seems to simplify securing and authenticating endpoint requests, and I wanted to clarify a few things:
Do I use cloud-endpoints as an API Gateway which routes requests to the individual microservice backends or are the microservices supposed to be built as individual endpoints-apps themselves?
Do I host the Angular 4 app statically (server agnostic), and make endpoint requests directly to the Gateway/microservice from the ng client, or is the app hosted through a server framework (e.g. node.js/express) which then passes on the request along to the Gateway/microservice
Endpoints is an API gateway, but it currently only routes to a single backend. On Flex, it's whatever app you deploy. The Endpoints proxy sits in front of your backend, transparently to the client, and the client requests will pass through the gateway. See the docs for how to set up your Flexible environment.
In conjunction with a dispatch.yaml directive to handle routing, you can use GCE as a gateway to multiple microservices running as services in a given project.
You can call the services directly or proxy through a server.

Routing static content in downstream services using Spring Cloud ZUUL

I am using Spring Cloud ZUUL as gateway to all downstream services.
I now have a NodeJS based service which I also route using Spring Cloud ZUUL and Spring Cloud SideCar.
The NodeJS based service references some static content, images,css and also javascript.
When ZUUL is routing the request to NodeJS via the SideCar, I see the static content and javasript files are not been downloaded.
The url for them points to the host and port of ZUUL instance, instead of the host and port of the actual downstream service. So, it seems like I need to add some configuration to route to the static resources within the downstream app, in this case, NodeJS app or something similar.
Can someone help me with the right way to approach this issue.
active blocking sensitive headers
routes:
node-service:
sensitiveHeaders: Cookie,Set-Cookie

IBM API Connect apps published to Bluemix inaccessible

I followed API Connect getting started guide to create a local loopback API app and tested successfully. Then I am trying to follow Publish Your API to Bluemix. The publishing is successful. The app is running. But clicking the app yields Chrome error:
This site can’t provide a secure connection
ddd.abbr-dev2.apic.mybluemix.net sent an invalid response.
I suspect the problem is incorrect port. According to CloudFoundry Nodejs tips, the port should use process.env.PORT, but loopback defaults to 3000. Following this clue, I tried adding config.local.js:
module.exports = {
port: process.env.PORT
};
But the service end point is still inaccessible.
Please Help. Thanks
This is actually by design. Since your API's implementation is on the public internet, it is secured via Mutual TLS. The only way to access it is via the API Connect gateway, thus ensuring the API is managed.
If you want to make it accessible publicly, open the app in the Bluemix console and add an additional route to the app, using the mybluemix.net domain.

Resources