This repository contains the necessary files to host restful API's using Protocol Buffers (a.k.a protobuf) under golang to run a database. Information on protocol buffers can be found on protobufs Google Developers site. All of the endpoints are hosted using Heroku. The database was implemented using MongoDB with the help of the public MongoDB driver mgo and is being hosted using mLab. This repository handles requests from multiple pages of our website dealing with user profile information.
Make sure mgo, glog, grpc-gateway, cors, and grpc are installed in your golang environment. To execute the program run the server.go file as follows,
go run server.go
This will execute the server file.
Each endpoint expects to receive specific fields to process a request. The following are the expectations for each endpoint and the response. The API link is https://tea-user-profile-api.herokuapp.com/. Note that each endpoint only accepts POST requests, so the link will only display a "Not Found" message since GET requests aren't supported.
| Endpoint | Request | Response |
|---|---|---|
| getuserprofile | string email = 1; | string profileimage = 1; string profiledescription = 2; repeated string endorsements = 3; repeated string currentprojects = 4; repeated string previousprojects = 5; |
| updateuserprofile | string email = 1; string profileimage = 2; string profiledescription = 3; repeated string currentprojects = 4; repeated string previousprojects = 5; |
bool success = 1; |