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

Fast Pickup Collect Feature in Unity

Bots and Game Ideation

Customize Hero Animation in Flutter (Part 1)

Manage my Events with Flow across Microsoft 365

Brief Guide to AWS Step Functions with Sample Workflow

Spring Batch — call existing Service

Mobility of data (and its analysis)

An Intro to Web Scraping with lxml and Python

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

Responsive Terminal Applications in Golang

Blokhus Watch Tower

Password Hashing with Golang and PostgreSQL

JWT tokens & Go (Golang): Easy explanation