Building Micro-services with GO | Part1

  • Developing Microservices in GO.
  • Creating Http Web Server in GO.
  • Read the request body in GO.
  • Write the response back in GO.
  • Handling Error in Go.
  • Accessing the handler from different package in Go.
  • It registers the handler function for the given pattern in the DefaultServeMux.
  • It creates an HttpHandler from it and adds it to the DefaultServeMux.
  • It is responsible for redirecting the paths. It contains the logic to be able to determine, which particular handler is to be called based upon the path.
  • Basically, it determines, which function would get executed whenever a request lands, depending upon where it has been mapped.
  • “http” package does have a DefaultServeMux. If we don’t set anything else up, this is the one, which is used by HandleFunc() function.
  • It allows you to have multiple handlers.
  • First parameter indicates the Port, where this server shall be hosted.
  • Second parameter indicates the Handler as simple as that. If we don’t specify anything
  • In the left-terminal, we have started our server.
  • In the right-terminal, we have verified by hitting to the hosted API.




Software Engineer for Big Data distributed systems

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to Create a Wave System in Unity (Part 3 — Start New Wave)

What’s the Deal with Servers Anyway?

How to host VS Code on a vps using Coder (aka:code-server)

Nervos CKB Development Dossier #42

OpenShift 4.5 install on Bare Metal

Rails to Heroku: A brief walkthrough for you

How to (really badly) sell your Integromat App

Resiliency patterns with Spring Boot and Resilience4j

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
aditya goel

aditya goel

Software Engineer for Big Data distributed systems

More from Medium

Building Micro-services with GO | Part2

Learn how to containerize your Go app in 5 minutes!

[Crazy Go Day] Why Using Gin For Golang Backend?

[Golang] Dealing with Errors in Golang