Dynamic JSON Parsing

Almost always when writing a REST endpoint you will know beforehand the format of the data you will receive and you can write your downstream client accordingly. Barring documentation you can parse a curl response and adjust accordingly, but what if the tables were turned and you needed to dynamically parse unknown JSON? In Python, with a dynamic type system, this is relatively straight forward. Let’s parse and print the results such as in this example. [Read More]
Go  REST 

Simple IPC with gRPC

Once an application has been broken up into microservices there is a need for these processes to communicate with one another. Enter gRPC a consistent, lightweight remote procedure call framework. Loosely speaking, the protocol allows a client and server to communicate via HTTP2 through an interface called a protocol buffer. Refer to this page for a visual breakdown of the call flow. Without getting bogged down in the details, suffice to say grpc’s strict protocol definitions are advantageous to developers by simplifying the hassle around Inter-process Communication (IPC). [Read More]
Go 

Go Rest Endpoint

An example of a simple REST endpoint in go is: https://github.com/kcotten/restep Choosing gorilla/mux yields a cleaner, simpler interface that works well with the standard library. From main() instantiate the router, for handling the HTTP routes, initialize it, and finally listen and serve. The router instantiated is the mux.Router that we will use to register routes to be served. Since this is just an example nothing more sophisticated than serving a GET endpoint at /info is happening. [Read More]

Dockerize Your Go Web App

After browsing around the internet I couldn’t find any guides for exactly what I wanted to do with a prototype I was writing and so decided to share my discoveries. After writing your web app in Go to get it ready for deployment in docker (and later to the cloud) create a new file named dockerfile in the main directory ~/go/src/<my-app>. Check the version of go you are using quickly with $ go version and then add the following to your new dockerfile: [Read More]