Discover Packages
github.com/codeuniversity/smag-mvp
api
directory
Version:
v0.0.0-...-ae3587a
Opens a new window with list of versions in this module.
Published: Mar 24, 2020
License: LGPL-3.0
Opens a new window with license information.
README
README
¶
SMAG gRPC Web API
About
In our project we are using a gRPC Web API. For that we are using an envoy proxy to be able to connect to the gRPC Server. As our system is not publicly accessible an AWS Account in our Organisation with the appropriate access is required.
Requirements
In order to successfully use our api make sure to have:
a running kubernetes setup (permssion required)
optional for local testing : protoc to generate the protofiles for the frontend
Usage
To use the production enviroment do the following steps:
Get name of envoy proxy kubectl get pods | grep envoy
Forward the envoy-pod port with kubectl port-forward envoy-proxy-deployment-6b89675d5b-d86c4 4000:8080
To make use of the API in the React Frontend import and run the following:
import {
User,
UserNameRequest,
UserIdRequest,
InstaPostsResponse,
UserSearchResponse
} from "./protofiles/client/usersearch_pb.js";
import { UserSearchServiceClient } from "./protofiles/client/usersearch_grpc_web_pb.js";
var userSearch = new UserSearchServiceClient("http://localhost:4000");
var request = new UserName();
request.setUserName("codeuniversity");
userSearch.getUserWithUsername(request, {}, function(err, response) {
//example function call...
});
Functions
To check the attributes of the proto messages take a look at the protofile userserach.proto
Method
Function Name
Input Message
Return Message
GET
getUserWithUsername
UserNameRequest
User
GET
getAllUsersLikeUsername
UserNameRequest
UserSearchResponse
GET
getTaggedPostsWithUserId
UserIdRequest
InstaPostsResponse
GET
getInstaPostssWithUserid
UserIdRequest
UserSearchResponse
Expand ▾
Collapse ▴
Directories
¶
Click to show internal directories.
Click to hide internal directories.