[{"data":1,"prerenderedAt":2642},["ShallowReactive",2],{"blog-go-middleware":3,"blog-all-for-related":2186},{"id":4,"title":5,"author":6,"body":7,"cardAlt":5,"categories":2172,"description":2174,"draft":2175,"extension":2176,"headerImage":2177,"keywords":2178,"meta":2179,"name":2180,"navigation":122,"path":2181,"seo":2182,"series":6,"stem":2183,"updated":6,"year":2184,"__hash__":2185},"blog\u002Fblog\u002Fgo-middleware.md","Mastering Middlewares in Golang",null,{"type":8,"value":9,"toc":2156},"minimark",[10,27,30,46,57,75,2152],[11,12,13,14,18,19,26],"p",{},"Middleware is a piece of code that ",[15,16,17],"strong",{},"executes"," on requests from a client to perfrom some operation before\u002Fafter the server processes the request and serves the response back to client. The request is chained from one middle to another until the final executing handler processes it. A common use case of middleware is to server a logic that is common across multiple endpoints (remember ",[20,21,25],"a",{"href":22,"rel":23},"https:\u002F\u002Fwww.mohitkhare.com\u002Fblog\u002Fsolid-dry-kiss-yagni\u002F",[24],"nofollow","DRY principle",").",[11,28,29],{},"Some common examples for middlewares are:",[31,32,33,37,40,43],"ul",{},[34,35,36],"li",{},"logging",[34,38,39],{},"authentication",[34,41,42],{},"data collection",[34,44,45],{},"recovery",[11,47,48,49,52,53,56],{},"A middleware can do ",[15,50,51],{},"validations"," on the request and ",[15,54,55],{},"add\u002Fupdate the response"," before it is passed onto the client. In this article we will learn how to write a middleware in golang. We'll also explore how to chain multiple middlewares on a single route. Let's get started!",[58,59,60],"blockquote",{},[11,61,62,63,68,69,74],{},"Do explore articles on ",[20,64,67],{"href":65,"rel":66},"https:\u002F\u002Fwww.mohitkhare.com\u002Fcategories\u002Fgolang",[24],"Golang"," and ",[20,70,73],{"href":71,"rel":72},"https:\u002F\u002Fwww.mohitkhare.com\u002Fcategories\u002Fsystem%20design",[24],"System Design",". You'll learn something new 💡",[76,77,78,81,86,91,94,327,335,356,360,363,520,527,530,538,564,568,571,970,982,1091,1093,1097,1100,1104,1107,1210,1214,1221,1377,1381,1390,1617,1619,1623,1626,1738,1745,2075,2077,2081,2097,2101,2124,2133,2135,2138,2147],"ads",{},[79,80],"hr",{},[82,83,85],"h2",{"id":84},"basic-middleware","Basic Middleware",[87,88,90],"h3",{"id":89},"creating-a-route","Creating a route",[11,92,93],{},"To actually use a middleware we first need a basic route handler. Let's create a simple route and a handler for this.",[95,96,101],"pre",{"className":97,"code":98,"language":99,"meta":100,"style":100},"language-go shiki shiki-themes github-light github-dark","package main\n\nimport (\n    \"fmt\"\n    \"log\"\n    \"net\u002Fhttp\"\n)\n\nfunc handler(w http.ResponseWriter, r *http.Request) {\n    fmt.Prinln(\"Inside the handler\")\n    w.Write([]byte(\"OK - executing handler\"))\n}\n\nfunc main() {\n    http.Handle(\"\u002F\", handler)\n    http.ListenAndServe(\":8000\", nil)\n}\n","go","",[102,103,104,117,124,134,147,157,167,173,178,223,239,262,268,273,284,301,322],"code",{"__ignoreMap":100},[105,106,109,113],"span",{"class":107,"line":108},"line",1,[105,110,112],{"class":111},"szBVR","package",[105,114,116],{"class":115},"sScJk"," main\n",[105,118,120],{"class":107,"line":119},2,[105,121,123],{"emptyLinePlaceholder":122},true,"\n",[105,125,127,130],{"class":107,"line":126},3,[105,128,129],{"class":111},"import",[105,131,133],{"class":132},"sVt8B"," (\n",[105,135,137,141,144],{"class":107,"line":136},4,[105,138,140],{"class":139},"sZZnC","    \"",[105,142,143],{"class":115},"fmt",[105,145,146],{"class":139},"\"\n",[105,148,150,152,155],{"class":107,"line":149},5,[105,151,140],{"class":139},[105,153,154],{"class":115},"log",[105,156,146],{"class":139},[105,158,160,162,165],{"class":107,"line":159},6,[105,161,140],{"class":139},[105,163,164],{"class":115},"net\u002Fhttp",[105,166,146],{"class":139},[105,168,170],{"class":107,"line":169},7,[105,171,172],{"class":132},")\n",[105,174,176],{"class":107,"line":175},8,[105,177,123],{"emptyLinePlaceholder":122},[105,179,181,184,187,190,194,197,200,203,206,209,212,215,217,220],{"class":107,"line":180},9,[105,182,183],{"class":111},"func",[105,185,186],{"class":115}," handler",[105,188,189],{"class":132},"(",[105,191,193],{"class":192},"s4XuR","w",[105,195,196],{"class":115}," http",[105,198,199],{"class":132},".",[105,201,202],{"class":115},"ResponseWriter",[105,204,205],{"class":132},", ",[105,207,208],{"class":192},"r",[105,210,211],{"class":111}," *",[105,213,214],{"class":115},"http",[105,216,199],{"class":132},[105,218,219],{"class":115},"Request",[105,221,222],{"class":132},") {\n",[105,224,226,229,232,234,237],{"class":107,"line":225},10,[105,227,228],{"class":132},"    fmt.",[105,230,231],{"class":115},"Prinln",[105,233,189],{"class":132},[105,235,236],{"class":139},"\"Inside the handler\"",[105,238,172],{"class":132},[105,240,242,245,248,251,254,256,259],{"class":107,"line":241},11,[105,243,244],{"class":132},"    w.",[105,246,247],{"class":115},"Write",[105,249,250],{"class":132},"([]",[105,252,253],{"class":111},"byte",[105,255,189],{"class":132},[105,257,258],{"class":139},"\"OK - executing handler\"",[105,260,261],{"class":132},"))\n",[105,263,265],{"class":107,"line":264},12,[105,266,267],{"class":132},"}\n",[105,269,271],{"class":107,"line":270},13,[105,272,123],{"emptyLinePlaceholder":122},[105,274,276,278,281],{"class":107,"line":275},14,[105,277,183],{"class":111},[105,279,280],{"class":115}," main",[105,282,283],{"class":132},"() {\n",[105,285,287,290,293,295,298],{"class":107,"line":286},15,[105,288,289],{"class":132},"    http.",[105,291,292],{"class":115},"Handle",[105,294,189],{"class":132},[105,296,297],{"class":139},"\"\u002F\"",[105,299,300],{"class":132},", handler)\n",[105,302,304,306,309,311,314,316,320],{"class":107,"line":303},16,[105,305,289],{"class":132},[105,307,308],{"class":115},"ListenAndServe",[105,310,189],{"class":132},[105,312,313],{"class":139},"\":8000\"",[105,315,205],{"class":132},[105,317,319],{"class":318},"sj4cs","nil",[105,321,172],{"class":132},[105,323,325],{"class":107,"line":324},17,[105,326,267],{"class":132},[11,328,329,330,334],{},"Make a GET call to ",[20,331,332],{"href":332,"rel":333},"http:\u002F\u002Flocalhost:8000\u002F",[24]," and you should see this response.",[95,336,340],{"className":337,"code":338,"language":339,"meta":100,"style":100},"language-bash shiki shiki-themes github-light github-dark","OK - executing handler\n","bash",[102,341,342],{"__ignoreMap":100},[105,343,344,347,350,353],{"class":107,"line":108},[105,345,346],{"class":115},"OK",[105,348,349],{"class":139}," -",[105,351,352],{"class":139}," executing",[105,354,355],{"class":139}," handler\n",[87,357,359],{"id":358},"building-the-middleware","Building the Middleware",[11,361,362],{},"Now that we have a route ready, let's create a simple logging middleware.",[95,364,366],{"className":97,"code":365,"language":99,"meta":100,"style":100},"func loggingMiddleware(next http.Handler) http.Handler {\n    return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n        fmt.Println(\"Before handler is executed\")\n        w.Write([]byte(\"Adding response via middleware\\n\"))\n        log.Println(r.URL.Path)\n        next.ServeHTTP(w, r)\n        fmt.Println(\"After handler is executed\")\n    })\n}\n",[102,367,368,399,438,453,477,487,498,511,516],{"__ignoreMap":100},[105,369,370,372,375,377,380,382,384,387,390,392,394,396],{"class":107,"line":108},[105,371,183],{"class":111},[105,373,374],{"class":115}," loggingMiddleware",[105,376,189],{"class":132},[105,378,379],{"class":192},"next",[105,381,196],{"class":115},[105,383,199],{"class":132},[105,385,386],{"class":115},"Handler",[105,388,389],{"class":132},") ",[105,391,214],{"class":115},[105,393,199],{"class":132},[105,395,386],{"class":115},[105,397,398],{"class":132}," {\n",[105,400,401,404,407,410,412,414,416,418,420,422,424,426,428,430,432,434,436],{"class":107,"line":119},[105,402,403],{"class":111},"    return",[105,405,406],{"class":132}," http.",[105,408,409],{"class":115},"HandlerFunc",[105,411,189],{"class":132},[105,413,183],{"class":111},[105,415,189],{"class":132},[105,417,193],{"class":192},[105,419,196],{"class":115},[105,421,199],{"class":132},[105,423,202],{"class":115},[105,425,205],{"class":132},[105,427,208],{"class":192},[105,429,211],{"class":111},[105,431,214],{"class":115},[105,433,199],{"class":132},[105,435,219],{"class":115},[105,437,222],{"class":132},[105,439,440,443,446,448,451],{"class":107,"line":126},[105,441,442],{"class":132},"        fmt.",[105,444,445],{"class":115},"Println",[105,447,189],{"class":132},[105,449,450],{"class":139},"\"Before handler is executed\"",[105,452,172],{"class":132},[105,454,455,458,460,462,464,466,469,472,475],{"class":107,"line":136},[105,456,457],{"class":132},"        w.",[105,459,247],{"class":115},[105,461,250],{"class":132},[105,463,253],{"class":111},[105,465,189],{"class":132},[105,467,468],{"class":139},"\"Adding response via middleware",[105,470,471],{"class":318},"\\n",[105,473,474],{"class":139},"\"",[105,476,261],{"class":132},[105,478,479,482,484],{"class":107,"line":149},[105,480,481],{"class":132},"        log.",[105,483,445],{"class":115},[105,485,486],{"class":132},"(r.URL.Path)\n",[105,488,489,492,495],{"class":107,"line":159},[105,490,491],{"class":132},"        next.",[105,493,494],{"class":115},"ServeHTTP",[105,496,497],{"class":132},"(w, r)\n",[105,499,500,502,504,506,509],{"class":107,"line":169},[105,501,442],{"class":132},[105,503,445],{"class":115},[105,505,189],{"class":132},[105,507,508],{"class":139},"\"After handler is executed\"",[105,510,172],{"class":132},[105,512,513],{"class":107,"line":175},[105,514,515],{"class":132},"    })\n",[105,517,518],{"class":107,"line":180},[105,519,267],{"class":132},[521,522,524],"h4",{"id":523},"explanation",[15,525,526],{},"Explanation",[11,528,529],{},"What we've done here is to define a new function that takes in our original handler and creates a wrapper on it to execute some operations before and after calling the original handler.",[11,531,532],{},[15,533,534],{},[535,536,537],"em",{},"Here's how the flow works",[539,540,541,548,555,558],"ol",{},[34,542,543,544,547],{},"Request comes on a route. Since route has a middleware to it ",[102,545,546],{},"loggingMiddleware"," is called. (Don't worrry in next section we'll cover how to add middleware to your routes)",[34,549,550,551,554],{},"Logging handler prints ",[102,552,553],{},"Before handler is executed"," , writes a response and logs the URL path.",[34,556,557],{},"Now, the original handler is served.",[34,559,560,561,563],{},"Post execution, the middleware function returns back the ",[102,562,409],{}," to the route.",[87,565,567],{"id":566},"setting-up-middleware","Setting up Middleware",[11,569,570],{},"Now that we have our middleware function ready to be used, let's add it to our defined route. Here's the complete program - notice the change where we define our route.",[95,572,574],{"className":97,"code":573,"language":99,"meta":100,"style":100},"package main\n\nimport (\n    \"fmt\"\n    \"log\"\n    \"net\u002Fhttp\"\n)\n\nfunc loggingMiddleware(next http.Handler) http.Handler {\n    return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n        fmt.Println(\"Before handler is executed\")\n        w.Write([]byte(\"Adding response via middleware\\n\"))\n        log.Println(r.URL.Path)\n        next.ServeHTTP(w, r)\n        fmt.Println(\"After handler is executed\")\n    })\n}\n\nfunc handler(w http.ResponseWriter, r *http.Request) {\n    fmt.Println(\"Inside the handler\")\n    _, err := w.Write([]byte(\"OK - executing handler\"))\n    if err != nil {\n        fmt.Println(\"Error writing response\")\n    }\n}\n\nfunc main() {\n  http.Handle(\"\u002F\", loggingMiddleware(http.HandlerFunc(handler))) \u002F\u002F --> adding middleware to route\n    err := http.ListenAndServe(\":8000\", nil)\n    if err != nil {\n        fmt.Println(\"Error: setting up server\")\n    }\n}\n",[102,575,576,582,586,592,600,608,616,620,624,650,686,698,718,726,734,746,750,754,759,790,803,827,844,858,864,869,874,883,911,933,946,960,965],{"__ignoreMap":100},[105,577,578,580],{"class":107,"line":108},[105,579,112],{"class":111},[105,581,116],{"class":115},[105,583,584],{"class":107,"line":119},[105,585,123],{"emptyLinePlaceholder":122},[105,587,588,590],{"class":107,"line":126},[105,589,129],{"class":111},[105,591,133],{"class":132},[105,593,594,596,598],{"class":107,"line":136},[105,595,140],{"class":139},[105,597,143],{"class":115},[105,599,146],{"class":139},[105,601,602,604,606],{"class":107,"line":149},[105,603,140],{"class":139},[105,605,154],{"class":115},[105,607,146],{"class":139},[105,609,610,612,614],{"class":107,"line":159},[105,611,140],{"class":139},[105,613,164],{"class":115},[105,615,146],{"class":139},[105,617,618],{"class":107,"line":169},[105,619,172],{"class":132},[105,621,622],{"class":107,"line":175},[105,623,123],{"emptyLinePlaceholder":122},[105,625,626,628,630,632,634,636,638,640,642,644,646,648],{"class":107,"line":180},[105,627,183],{"class":111},[105,629,374],{"class":115},[105,631,189],{"class":132},[105,633,379],{"class":192},[105,635,196],{"class":115},[105,637,199],{"class":132},[105,639,386],{"class":115},[105,641,389],{"class":132},[105,643,214],{"class":115},[105,645,199],{"class":132},[105,647,386],{"class":115},[105,649,398],{"class":132},[105,651,652,654,656,658,660,662,664,666,668,670,672,674,676,678,680,682,684],{"class":107,"line":225},[105,653,403],{"class":111},[105,655,406],{"class":132},[105,657,409],{"class":115},[105,659,189],{"class":132},[105,661,183],{"class":111},[105,663,189],{"class":132},[105,665,193],{"class":192},[105,667,196],{"class":115},[105,669,199],{"class":132},[105,671,202],{"class":115},[105,673,205],{"class":132},[105,675,208],{"class":192},[105,677,211],{"class":111},[105,679,214],{"class":115},[105,681,199],{"class":132},[105,683,219],{"class":115},[105,685,222],{"class":132},[105,687,688,690,692,694,696],{"class":107,"line":241},[105,689,442],{"class":132},[105,691,445],{"class":115},[105,693,189],{"class":132},[105,695,450],{"class":139},[105,697,172],{"class":132},[105,699,700,702,704,706,708,710,712,714,716],{"class":107,"line":264},[105,701,457],{"class":132},[105,703,247],{"class":115},[105,705,250],{"class":132},[105,707,253],{"class":111},[105,709,189],{"class":132},[105,711,468],{"class":139},[105,713,471],{"class":318},[105,715,474],{"class":139},[105,717,261],{"class":132},[105,719,720,722,724],{"class":107,"line":270},[105,721,481],{"class":132},[105,723,445],{"class":115},[105,725,486],{"class":132},[105,727,728,730,732],{"class":107,"line":275},[105,729,491],{"class":132},[105,731,494],{"class":115},[105,733,497],{"class":132},[105,735,736,738,740,742,744],{"class":107,"line":286},[105,737,442],{"class":132},[105,739,445],{"class":115},[105,741,189],{"class":132},[105,743,508],{"class":139},[105,745,172],{"class":132},[105,747,748],{"class":107,"line":303},[105,749,515],{"class":132},[105,751,752],{"class":107,"line":324},[105,753,267],{"class":132},[105,755,757],{"class":107,"line":756},18,[105,758,123],{"emptyLinePlaceholder":122},[105,760,762,764,766,768,770,772,774,776,778,780,782,784,786,788],{"class":107,"line":761},19,[105,763,183],{"class":111},[105,765,186],{"class":115},[105,767,189],{"class":132},[105,769,193],{"class":192},[105,771,196],{"class":115},[105,773,199],{"class":132},[105,775,202],{"class":115},[105,777,205],{"class":132},[105,779,208],{"class":192},[105,781,211],{"class":111},[105,783,214],{"class":115},[105,785,199],{"class":132},[105,787,219],{"class":115},[105,789,222],{"class":132},[105,791,793,795,797,799,801],{"class":107,"line":792},20,[105,794,228],{"class":132},[105,796,445],{"class":115},[105,798,189],{"class":132},[105,800,236],{"class":139},[105,802,172],{"class":132},[105,804,806,809,812,815,817,819,821,823,825],{"class":107,"line":805},21,[105,807,808],{"class":132},"    _, err ",[105,810,811],{"class":111},":=",[105,813,814],{"class":132}," w.",[105,816,247],{"class":115},[105,818,250],{"class":132},[105,820,253],{"class":111},[105,822,189],{"class":132},[105,824,258],{"class":139},[105,826,261],{"class":132},[105,828,830,833,836,839,842],{"class":107,"line":829},22,[105,831,832],{"class":111},"    if",[105,834,835],{"class":132}," err ",[105,837,838],{"class":111},"!=",[105,840,841],{"class":318}," nil",[105,843,398],{"class":132},[105,845,847,849,851,853,856],{"class":107,"line":846},23,[105,848,442],{"class":132},[105,850,445],{"class":115},[105,852,189],{"class":132},[105,854,855],{"class":139},"\"Error writing response\"",[105,857,172],{"class":132},[105,859,861],{"class":107,"line":860},24,[105,862,863],{"class":132},"    }\n",[105,865,867],{"class":107,"line":866},25,[105,868,267],{"class":132},[105,870,872],{"class":107,"line":871},26,[105,873,123],{"emptyLinePlaceholder":122},[105,875,877,879,881],{"class":107,"line":876},27,[105,878,183],{"class":111},[105,880,280],{"class":115},[105,882,283],{"class":132},[105,884,886,889,891,893,895,897,899,902,904,907],{"class":107,"line":885},28,[105,887,888],{"class":132},"  http.",[105,890,292],{"class":115},[105,892,189],{"class":132},[105,894,297],{"class":139},[105,896,205],{"class":132},[105,898,546],{"class":115},[105,900,901],{"class":132},"(http.",[105,903,409],{"class":115},[105,905,906],{"class":132},"(handler))) ",[105,908,910],{"class":909},"sJ8bj","\u002F\u002F --> adding middleware to route\n",[105,912,914,917,919,921,923,925,927,929,931],{"class":107,"line":913},29,[105,915,916],{"class":132},"    err ",[105,918,811],{"class":111},[105,920,406],{"class":132},[105,922,308],{"class":115},[105,924,189],{"class":132},[105,926,313],{"class":139},[105,928,205],{"class":132},[105,930,319],{"class":318},[105,932,172],{"class":132},[105,934,936,938,940,942,944],{"class":107,"line":935},30,[105,937,832],{"class":111},[105,939,835],{"class":132},[105,941,838],{"class":111},[105,943,841],{"class":318},[105,945,398],{"class":132},[105,947,949,951,953,955,958],{"class":107,"line":948},31,[105,950,442],{"class":132},[105,952,445],{"class":115},[105,954,189],{"class":132},[105,956,957],{"class":139},"\"Error: setting up server\"",[105,959,172],{"class":132},[105,961,963],{"class":107,"line":962},32,[105,964,863],{"class":132},[105,966,968],{"class":107,"line":967},33,[105,969,267],{"class":132},[11,971,972,973,977,978,981],{},"Let's try to make a GET call on ",[20,974,975],{"href":975,"rel":976},"http:\u002F\u002Flocalhost:8080\u002F",[24]," . We should see the middleware print statements and logs in your terminal. The response would also have ",[102,979,980],{},"Adding response via middleware",". Congrats! You just wrote a working middleware in Go.",[95,983,985],{"className":337,"code":984,"language":339,"meta":100,"style":100},"Response:\nAdding response via middleware\nOK - executing handler\n\nServer output\nBefore handler is executed\n2022\u002F03\u002F13 12:11:22 \u002F  --> url path with timestamp\nInside the handler\nAfter handler is executed\n",[102,986,987,992,1006,1016,1020,1028,1041,1070,1080],{"__ignoreMap":100},[105,988,989],{"class":107,"line":108},[105,990,991],{"class":115},"Response:\n",[105,993,994,997,1000,1003],{"class":107,"line":119},[105,995,996],{"class":115},"Adding",[105,998,999],{"class":139}," response",[105,1001,1002],{"class":139}," via",[105,1004,1005],{"class":139}," middleware\n",[105,1007,1008,1010,1012,1014],{"class":107,"line":126},[105,1009,346],{"class":115},[105,1011,349],{"class":139},[105,1013,352],{"class":139},[105,1015,355],{"class":139},[105,1017,1018],{"class":107,"line":136},[105,1019,123],{"emptyLinePlaceholder":122},[105,1021,1022,1025],{"class":107,"line":149},[105,1023,1024],{"class":115},"Server",[105,1026,1027],{"class":139}," output\n",[105,1029,1030,1033,1035,1038],{"class":107,"line":159},[105,1031,1032],{"class":115},"Before",[105,1034,186],{"class":139},[105,1036,1037],{"class":139}," is",[105,1039,1040],{"class":139}," executed\n",[105,1042,1043,1046,1049,1052,1055,1058,1061,1064,1067],{"class":107,"line":169},[105,1044,1045],{"class":115},"2022\u002F03\u002F13",[105,1047,1048],{"class":139}," 12:11:22",[105,1050,1051],{"class":139}," \u002F",[105,1053,1054],{"class":318},"  --",[105,1056,1057],{"class":111},">",[105,1059,1060],{"class":139}," url",[105,1062,1063],{"class":139}," path",[105,1065,1066],{"class":139}," with",[105,1068,1069],{"class":139}," timestamp\n",[105,1071,1072,1075,1078],{"class":107,"line":175},[105,1073,1074],{"class":115},"Inside",[105,1076,1077],{"class":139}," the",[105,1079,355],{"class":139},[105,1081,1082,1085,1087,1089],{"class":107,"line":180},[105,1083,1084],{"class":115},"After",[105,1086,186],{"class":139},[105,1088,1037],{"class":139},[105,1090,1040],{"class":139},[79,1092],{},[82,1094,1096],{"id":1095},"advanced-middlewares","Advanced middlewares",[11,1098,1099],{},"In real world middlewares are used quite extensively and serve a variety of purposes. Sharing some of the common middlewares that can come in handy during API development.",[87,1101,1103],{"id":1102},"adding-headers-in-middleware","Adding Headers in Middleware",[11,1105,1106],{},"Headers are an important part of REST APIs. Middleware can be used to add common headers across routes.",[95,1108,1110],{"className":97,"code":1109,"language":99,"meta":100,"style":100},"func headerMiddleware(next http.HandlerFunc) http.HandlerFunc {\n    return func(w http.ResponseWriter, r *http.Request) {\n        w.Header().Add(\"Content-Type\", \"application\u002Fjson\")\n        next(w, r)\n    }\n}\n",[102,1111,1112,1139,1170,1195,1202,1206],{"__ignoreMap":100},[105,1113,1114,1116,1119,1121,1123,1125,1127,1129,1131,1133,1135,1137],{"class":107,"line":108},[105,1115,183],{"class":111},[105,1117,1118],{"class":115}," headerMiddleware",[105,1120,189],{"class":132},[105,1122,379],{"class":192},[105,1124,196],{"class":115},[105,1126,199],{"class":132},[105,1128,409],{"class":115},[105,1130,389],{"class":132},[105,1132,214],{"class":115},[105,1134,199],{"class":132},[105,1136,409],{"class":115},[105,1138,398],{"class":132},[105,1140,1141,1143,1146,1148,1150,1152,1154,1156,1158,1160,1162,1164,1166,1168],{"class":107,"line":119},[105,1142,403],{"class":111},[105,1144,1145],{"class":111}," func",[105,1147,189],{"class":132},[105,1149,193],{"class":192},[105,1151,196],{"class":115},[105,1153,199],{"class":132},[105,1155,202],{"class":115},[105,1157,205],{"class":132},[105,1159,208],{"class":192},[105,1161,211],{"class":111},[105,1163,214],{"class":115},[105,1165,199],{"class":132},[105,1167,219],{"class":115},[105,1169,222],{"class":132},[105,1171,1172,1174,1177,1180,1183,1185,1188,1190,1193],{"class":107,"line":126},[105,1173,457],{"class":132},[105,1175,1176],{"class":115},"Header",[105,1178,1179],{"class":132},"().",[105,1181,1182],{"class":115},"Add",[105,1184,189],{"class":132},[105,1186,1187],{"class":139},"\"Content-Type\"",[105,1189,205],{"class":132},[105,1191,1192],{"class":139},"\"application\u002Fjson\"",[105,1194,172],{"class":132},[105,1196,1197,1200],{"class":107,"line":136},[105,1198,1199],{"class":115},"        next",[105,1201,497],{"class":132},[105,1203,1204],{"class":107,"line":149},[105,1205,863],{"class":132},[105,1207,1208],{"class":107,"line":159},[105,1209,267],{"class":132},[87,1211,1213],{"id":1212},"recovery-middleware","Recovery Middleware",[11,1215,1216,1217,1220],{},"Panics can happen anytime due to crashes, memory leak, etc. The server should be able to recover from such panics. Golang provides us with ",[102,1218,1219],{},"recover()"," function i.e a built-in function that regains control of a panicking goroutine.",[95,1222,1224],{"className":97,"code":1223,"language":99,"meta":100,"style":100},"func panicRecovery(next http.HandlerFunc) http.HandlerFunc {\n    return func(w http.ResponseWriter, req *http.Request) {\n        defer func() {\n            if err := recover(); err != nil {\n                http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n                log.Println(string(debug.Stack()))\n            }\n        }()\n        next(w, req)\n    }\n}\n",[102,1225,1226,1253,1284,1293,1314,1331,1352,1357,1362,1369,1373],{"__ignoreMap":100},[105,1227,1228,1230,1233,1235,1237,1239,1241,1243,1245,1247,1249,1251],{"class":107,"line":108},[105,1229,183],{"class":111},[105,1231,1232],{"class":115}," panicRecovery",[105,1234,189],{"class":132},[105,1236,379],{"class":192},[105,1238,196],{"class":115},[105,1240,199],{"class":132},[105,1242,409],{"class":115},[105,1244,389],{"class":132},[105,1246,214],{"class":115},[105,1248,199],{"class":132},[105,1250,409],{"class":115},[105,1252,398],{"class":132},[105,1254,1255,1257,1259,1261,1263,1265,1267,1269,1271,1274,1276,1278,1280,1282],{"class":107,"line":119},[105,1256,403],{"class":111},[105,1258,1145],{"class":111},[105,1260,189],{"class":132},[105,1262,193],{"class":192},[105,1264,196],{"class":115},[105,1266,199],{"class":132},[105,1268,202],{"class":115},[105,1270,205],{"class":132},[105,1272,1273],{"class":192},"req",[105,1275,211],{"class":111},[105,1277,214],{"class":115},[105,1279,199],{"class":132},[105,1281,219],{"class":115},[105,1283,222],{"class":132},[105,1285,1286,1289,1291],{"class":107,"line":126},[105,1287,1288],{"class":111},"        defer",[105,1290,1145],{"class":111},[105,1292,283],{"class":132},[105,1294,1295,1298,1300,1302,1305,1308,1310,1312],{"class":107,"line":136},[105,1296,1297],{"class":111},"            if",[105,1299,835],{"class":132},[105,1301,811],{"class":111},[105,1303,1304],{"class":115}," recover",[105,1306,1307],{"class":132},"(); err ",[105,1309,838],{"class":111},[105,1311,841],{"class":318},[105,1313,398],{"class":132},[105,1315,1316,1319,1322,1325,1328],{"class":107,"line":149},[105,1317,1318],{"class":132},"                http.",[105,1320,1321],{"class":115},"Error",[105,1323,1324],{"class":132},"(w, http.",[105,1326,1327],{"class":115},"StatusText",[105,1329,1330],{"class":132},"(http.StatusInternalServerError), http.StatusInternalServerError)\n",[105,1332,1333,1336,1338,1340,1343,1346,1349],{"class":107,"line":159},[105,1334,1335],{"class":132},"                log.",[105,1337,445],{"class":115},[105,1339,189],{"class":132},[105,1341,1342],{"class":111},"string",[105,1344,1345],{"class":132},"(debug.",[105,1347,1348],{"class":115},"Stack",[105,1350,1351],{"class":132},"()))\n",[105,1353,1354],{"class":107,"line":169},[105,1355,1356],{"class":132},"            }\n",[105,1358,1359],{"class":107,"line":175},[105,1360,1361],{"class":132},"        }()\n",[105,1363,1364,1366],{"class":107,"line":180},[105,1365,1199],{"class":115},[105,1367,1368],{"class":132},"(w, req)\n",[105,1370,1371],{"class":107,"line":225},[105,1372,863],{"class":132},[105,1374,1375],{"class":107,"line":241},[105,1376,267],{"class":132},[87,1378,1380],{"id":1379},"cors-middleware","CORS Middleware",[11,1382,1383,1384,1389],{},"You don't want your APIs to be accessible to request from another domain. To enhance security we can use a ",[20,1385,1388],{"href":1386,"rel":1387},"https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FCross-origin_resource_sharing",[24],"CORS"," middleware on the public routes.",[95,1391,1393],{"className":97,"code":1392,"language":99,"meta":100,"style":100},"func CORSMiddleware(next http.Handler) http.Handler {\n    return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n        origin := r.Header.Get(\"Origin\")\n        w.Header().Set(\"Access-Control-Allow-Origin\", origin)\n        if r.Method == \"OPTIONS\" {\n            w.Header().Set(\"Access-Control-Allow-Credentials\", \"true\")\n            w.Header().Set(\"Access-Control-Allow-Methods\", \"GET,POST\")\n            w.Header().Set(\"Access-Control-Allow-Headers\", \"Content-Type, X-CSRF-Token, Authorization\")\n            return\n        } else {\n            next.ServeHTTP(w, r)\n        }\n    })\n}\n",[102,1394,1395,1422,1458,1478,1497,1513,1536,1558,1580,1585,1595,1604,1609,1613],{"__ignoreMap":100},[105,1396,1397,1399,1402,1404,1406,1408,1410,1412,1414,1416,1418,1420],{"class":107,"line":108},[105,1398,183],{"class":111},[105,1400,1401],{"class":115}," CORSMiddleware",[105,1403,189],{"class":132},[105,1405,379],{"class":192},[105,1407,196],{"class":115},[105,1409,199],{"class":132},[105,1411,386],{"class":115},[105,1413,389],{"class":132},[105,1415,214],{"class":115},[105,1417,199],{"class":132},[105,1419,386],{"class":115},[105,1421,398],{"class":132},[105,1423,1424,1426,1428,1430,1432,1434,1436,1438,1440,1442,1444,1446,1448,1450,1452,1454,1456],{"class":107,"line":119},[105,1425,403],{"class":111},[105,1427,406],{"class":132},[105,1429,409],{"class":115},[105,1431,189],{"class":132},[105,1433,183],{"class":111},[105,1435,189],{"class":132},[105,1437,193],{"class":192},[105,1439,196],{"class":115},[105,1441,199],{"class":132},[105,1443,202],{"class":115},[105,1445,205],{"class":132},[105,1447,208],{"class":192},[105,1449,211],{"class":111},[105,1451,214],{"class":115},[105,1453,199],{"class":132},[105,1455,219],{"class":115},[105,1457,222],{"class":132},[105,1459,1460,1463,1465,1468,1471,1473,1476],{"class":107,"line":126},[105,1461,1462],{"class":132},"        origin ",[105,1464,811],{"class":111},[105,1466,1467],{"class":132}," r.Header.",[105,1469,1470],{"class":115},"Get",[105,1472,189],{"class":132},[105,1474,1475],{"class":139},"\"Origin\"",[105,1477,172],{"class":132},[105,1479,1480,1482,1484,1486,1489,1491,1494],{"class":107,"line":136},[105,1481,457],{"class":132},[105,1483,1176],{"class":115},[105,1485,1179],{"class":132},[105,1487,1488],{"class":115},"Set",[105,1490,189],{"class":132},[105,1492,1493],{"class":139},"\"Access-Control-Allow-Origin\"",[105,1495,1496],{"class":132},", origin)\n",[105,1498,1499,1502,1505,1508,1511],{"class":107,"line":149},[105,1500,1501],{"class":111},"        if",[105,1503,1504],{"class":132}," r.Method ",[105,1506,1507],{"class":111},"==",[105,1509,1510],{"class":139}," \"OPTIONS\"",[105,1512,398],{"class":132},[105,1514,1515,1518,1520,1522,1524,1526,1529,1531,1534],{"class":107,"line":159},[105,1516,1517],{"class":132},"            w.",[105,1519,1176],{"class":115},[105,1521,1179],{"class":132},[105,1523,1488],{"class":115},[105,1525,189],{"class":132},[105,1527,1528],{"class":139},"\"Access-Control-Allow-Credentials\"",[105,1530,205],{"class":132},[105,1532,1533],{"class":139},"\"true\"",[105,1535,172],{"class":132},[105,1537,1538,1540,1542,1544,1546,1548,1551,1553,1556],{"class":107,"line":169},[105,1539,1517],{"class":132},[105,1541,1176],{"class":115},[105,1543,1179],{"class":132},[105,1545,1488],{"class":115},[105,1547,189],{"class":132},[105,1549,1550],{"class":139},"\"Access-Control-Allow-Methods\"",[105,1552,205],{"class":132},[105,1554,1555],{"class":139},"\"GET,POST\"",[105,1557,172],{"class":132},[105,1559,1560,1562,1564,1566,1568,1570,1573,1575,1578],{"class":107,"line":175},[105,1561,1517],{"class":132},[105,1563,1176],{"class":115},[105,1565,1179],{"class":132},[105,1567,1488],{"class":115},[105,1569,189],{"class":132},[105,1571,1572],{"class":139},"\"Access-Control-Allow-Headers\"",[105,1574,205],{"class":132},[105,1576,1577],{"class":139},"\"Content-Type, X-CSRF-Token, Authorization\"",[105,1579,172],{"class":132},[105,1581,1582],{"class":107,"line":180},[105,1583,1584],{"class":111},"            return\n",[105,1586,1587,1590,1593],{"class":107,"line":225},[105,1588,1589],{"class":132},"        } ",[105,1591,1592],{"class":111},"else",[105,1594,398],{"class":132},[105,1596,1597,1600,1602],{"class":107,"line":241},[105,1598,1599],{"class":132},"            next.",[105,1601,494],{"class":115},[105,1603,497],{"class":132},[105,1605,1606],{"class":107,"line":264},[105,1607,1608],{"class":132},"        }\n",[105,1610,1611],{"class":107,"line":270},[105,1612,515],{"class":132},[105,1614,1615],{"class":107,"line":275},[105,1616,267],{"class":132},[79,1618],{},[82,1620,1622],{"id":1621},"chaining-middlewares","Chaining Middlewares",[11,1624,1625],{},"In the previous section we defined couple of middleware. Usually you would want to use more than one middleware on a route like Logging, panic, authorization, etc. Go provides us a way to chain multiple middlewares.",[95,1627,1629],{"className":97,"code":1628,"language":99,"meta":100,"style":100},"func main() {\n    http.Handle(\"\u002F\",\n        CORSMiddleware(\n            panicRecovery(\n                headerMiddleware(\n                    loggingMiddleware(http.HandlerFunc(handler))))))\n    err := http.ListenAndServe(\":8000\", nil)\n    if err != nil {\n        fmt.Println(\"Error: setting up server\")\n    }\n}\n",[102,1630,1631,1639,1652,1660,1667,1674,1686,1706,1718,1730,1734],{"__ignoreMap":100},[105,1632,1633,1635,1637],{"class":107,"line":108},[105,1634,183],{"class":111},[105,1636,280],{"class":115},[105,1638,283],{"class":132},[105,1640,1641,1643,1645,1647,1649],{"class":107,"line":119},[105,1642,289],{"class":132},[105,1644,292],{"class":115},[105,1646,189],{"class":132},[105,1648,297],{"class":139},[105,1650,1651],{"class":132},",\n",[105,1653,1654,1657],{"class":107,"line":126},[105,1655,1656],{"class":115},"        CORSMiddleware",[105,1658,1659],{"class":132},"(\n",[105,1661,1662,1665],{"class":107,"line":136},[105,1663,1664],{"class":115},"            panicRecovery",[105,1666,1659],{"class":132},[105,1668,1669,1672],{"class":107,"line":149},[105,1670,1671],{"class":115},"                headerMiddleware",[105,1673,1659],{"class":132},[105,1675,1676,1679,1681,1683],{"class":107,"line":159},[105,1677,1678],{"class":115},"                    loggingMiddleware",[105,1680,901],{"class":132},[105,1682,409],{"class":115},[105,1684,1685],{"class":132},"(handler))))))\n",[105,1687,1688,1690,1692,1694,1696,1698,1700,1702,1704],{"class":107,"line":169},[105,1689,916],{"class":132},[105,1691,811],{"class":111},[105,1693,406],{"class":132},[105,1695,308],{"class":115},[105,1697,189],{"class":132},[105,1699,313],{"class":139},[105,1701,205],{"class":132},[105,1703,319],{"class":318},[105,1705,172],{"class":132},[105,1707,1708,1710,1712,1714,1716],{"class":107,"line":175},[105,1709,832],{"class":111},[105,1711,835],{"class":132},[105,1713,838],{"class":111},[105,1715,841],{"class":318},[105,1717,398],{"class":132},[105,1719,1720,1722,1724,1726,1728],{"class":107,"line":180},[105,1721,442],{"class":132},[105,1723,445],{"class":115},[105,1725,189],{"class":132},[105,1727,957],{"class":139},[105,1729,172],{"class":132},[105,1731,1732],{"class":107,"line":225},[105,1733,863],{"class":132},[105,1735,1736],{"class":107,"line":241},[105,1737,267],{"class":132},[11,1739,1740,1741,1744],{},"You see the problem here? With a lot of middlewares the code is getting ugly. To solve this we can create a slice of ",[102,1742,1743],{},"Middleware"," type and iterate over this slice for each route.",[95,1746,1748],{"className":97,"code":1747,"language":99,"meta":100,"style":100},"type Middleware func(http.Handler) http.Handler\n\nfunc chainingMiddleware(h http.Handler, m ...Middleware) http.Handler {\n    if len(m) \u003C 1 {\n        return h\n    }\n\n    wrappedHandler := h\n    for i := len(m) - 1; i >= 0; i-- {\n        wrappedHandler = m[i](wrappedHandler)\n    }\n\n    return wrappedHandler\n}\n\nfunc main() {\n    commonMiddlewares := []Middleware{\n        CORSMiddleware,\n        panicRecovery,\n        headerMiddleware,\n        loggingMiddleware,\n    }\n\n    http.Handle(\"\u002F\", chainingMiddleware(http.HandlerFunc(handler), commonMiddlewares...))\n\n    err := http.ListenAndServe(\":8000\", nil)\n    if err != nil {\n        fmt.Println(\"Error: setting up server\")\n    }\n}\n",[102,1749,1750,1777,1781,1819,1837,1845,1849,1853,1862,1898,1918,1922,1926,1933,1937,1941,1949,1964,1969,1974,1979,1984,1988,1992,2019,2023,2043,2055,2067,2071],{"__ignoreMap":100},[105,1751,1752,1755,1758,1760,1762,1764,1766,1768,1770,1772,1774],{"class":107,"line":108},[105,1753,1754],{"class":111},"type",[105,1756,1757],{"class":115}," Middleware",[105,1759,1145],{"class":111},[105,1761,189],{"class":132},[105,1763,214],{"class":115},[105,1765,199],{"class":132},[105,1767,386],{"class":115},[105,1769,389],{"class":132},[105,1771,214],{"class":115},[105,1773,199],{"class":132},[105,1775,1776],{"class":115},"Handler\n",[105,1778,1779],{"class":107,"line":119},[105,1780,123],{"emptyLinePlaceholder":122},[105,1782,1783,1785,1788,1790,1793,1795,1797,1799,1801,1804,1807,1809,1811,1813,1815,1817],{"class":107,"line":126},[105,1784,183],{"class":111},[105,1786,1787],{"class":115}," chainingMiddleware",[105,1789,189],{"class":132},[105,1791,1792],{"class":192},"h",[105,1794,196],{"class":115},[105,1796,199],{"class":132},[105,1798,386],{"class":115},[105,1800,205],{"class":132},[105,1802,1803],{"class":192},"m",[105,1805,1806],{"class":111}," ...",[105,1808,1743],{"class":115},[105,1810,389],{"class":132},[105,1812,214],{"class":115},[105,1814,199],{"class":132},[105,1816,386],{"class":115},[105,1818,398],{"class":132},[105,1820,1821,1823,1826,1829,1832,1835],{"class":107,"line":136},[105,1822,832],{"class":111},[105,1824,1825],{"class":115}," len",[105,1827,1828],{"class":132},"(m) ",[105,1830,1831],{"class":111},"\u003C",[105,1833,1834],{"class":318}," 1",[105,1836,398],{"class":132},[105,1838,1839,1842],{"class":107,"line":149},[105,1840,1841],{"class":111},"        return",[105,1843,1844],{"class":132}," h\n",[105,1846,1847],{"class":107,"line":159},[105,1848,863],{"class":132},[105,1850,1851],{"class":107,"line":169},[105,1852,123],{"emptyLinePlaceholder":122},[105,1854,1855,1858,1860],{"class":107,"line":175},[105,1856,1857],{"class":132},"    wrappedHandler ",[105,1859,811],{"class":111},[105,1861,1844],{"class":132},[105,1863,1864,1867,1870,1872,1874,1876,1879,1881,1884,1887,1890,1893,1896],{"class":107,"line":180},[105,1865,1866],{"class":111},"    for",[105,1868,1869],{"class":132}," i ",[105,1871,811],{"class":111},[105,1873,1825],{"class":115},[105,1875,1828],{"class":132},[105,1877,1878],{"class":111},"-",[105,1880,1834],{"class":318},[105,1882,1883],{"class":132},"; i ",[105,1885,1886],{"class":111},">=",[105,1888,1889],{"class":318}," 0",[105,1891,1892],{"class":132},"; i",[105,1894,1895],{"class":111},"--",[105,1897,398],{"class":132},[105,1899,1900,1903,1906,1909,1912,1915],{"class":107,"line":225},[105,1901,1902],{"class":132},"        wrappedHandler ",[105,1904,1905],{"class":111},"=",[105,1907,1908],{"class":115}," m",[105,1910,1911],{"class":132},"[",[105,1913,1914],{"class":115},"i",[105,1916,1917],{"class":132},"](wrappedHandler)\n",[105,1919,1920],{"class":107,"line":241},[105,1921,863],{"class":132},[105,1923,1924],{"class":107,"line":264},[105,1925,123],{"emptyLinePlaceholder":122},[105,1927,1928,1930],{"class":107,"line":270},[105,1929,403],{"class":111},[105,1931,1932],{"class":132}," wrappedHandler\n",[105,1934,1935],{"class":107,"line":275},[105,1936,267],{"class":132},[105,1938,1939],{"class":107,"line":286},[105,1940,123],{"emptyLinePlaceholder":122},[105,1942,1943,1945,1947],{"class":107,"line":303},[105,1944,183],{"class":111},[105,1946,280],{"class":115},[105,1948,283],{"class":132},[105,1950,1951,1954,1956,1959,1961],{"class":107,"line":324},[105,1952,1953],{"class":132},"    commonMiddlewares ",[105,1955,811],{"class":111},[105,1957,1958],{"class":132}," []",[105,1960,1743],{"class":115},[105,1962,1963],{"class":132},"{\n",[105,1965,1966],{"class":107,"line":756},[105,1967,1968],{"class":132},"        CORSMiddleware,\n",[105,1970,1971],{"class":107,"line":761},[105,1972,1973],{"class":132},"        panicRecovery,\n",[105,1975,1976],{"class":107,"line":792},[105,1977,1978],{"class":132},"        headerMiddleware,\n",[105,1980,1981],{"class":107,"line":805},[105,1982,1983],{"class":132},"        loggingMiddleware,\n",[105,1985,1986],{"class":107,"line":829},[105,1987,863],{"class":132},[105,1989,1990],{"class":107,"line":846},[105,1991,123],{"emptyLinePlaceholder":122},[105,1993,1994,1996,1998,2000,2002,2004,2007,2009,2011,2014,2017],{"class":107,"line":860},[105,1995,289],{"class":132},[105,1997,292],{"class":115},[105,1999,189],{"class":132},[105,2001,297],{"class":139},[105,2003,205],{"class":132},[105,2005,2006],{"class":115},"chainingMiddleware",[105,2008,901],{"class":132},[105,2010,409],{"class":115},[105,2012,2013],{"class":132},"(handler), commonMiddlewares",[105,2015,2016],{"class":111},"...",[105,2018,261],{"class":132},[105,2020,2021],{"class":107,"line":866},[105,2022,123],{"emptyLinePlaceholder":122},[105,2024,2025,2027,2029,2031,2033,2035,2037,2039,2041],{"class":107,"line":871},[105,2026,916],{"class":132},[105,2028,811],{"class":111},[105,2030,406],{"class":132},[105,2032,308],{"class":115},[105,2034,189],{"class":132},[105,2036,313],{"class":139},[105,2038,205],{"class":132},[105,2040,319],{"class":318},[105,2042,172],{"class":132},[105,2044,2045,2047,2049,2051,2053],{"class":107,"line":876},[105,2046,832],{"class":111},[105,2048,835],{"class":132},[105,2050,838],{"class":111},[105,2052,841],{"class":318},[105,2054,398],{"class":132},[105,2056,2057,2059,2061,2063,2065],{"class":107,"line":885},[105,2058,442],{"class":132},[105,2060,445],{"class":115},[105,2062,189],{"class":132},[105,2064,957],{"class":139},[105,2066,172],{"class":132},[105,2068,2069],{"class":107,"line":913},[105,2070,863],{"class":132},[105,2072,2073],{"class":107,"line":935},[105,2074,267],{"class":132},[79,2076],{},[82,2078,2080],{"id":2079},"resources","Resources",[31,2082,2083,2090],{},[34,2084,2085],{},[20,2086,2089],{"href":2087,"rel":2088},"https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FMiddleware",[24],"Understanding Middleware",[34,2091,2092],{},[20,2093,2096],{"href":2094,"rel":2095},"https:\u002F\u002Fwww.alexedwards.net\u002Fblog\u002Fmaking-and-using-middleware",[24],"Using HTTP Middleware",[87,2098,2100],{"id":2099},"books-to-learn-golang","Books to learn Golang",[31,2102,2103,2110,2117],{},[34,2104,2105],{},[20,2106,2109],{"href":2107,"rel":2108},"https:\u002F\u002Famzn.to\u002F3fYLCqz",[24],"Go Programming Language",[34,2111,2112],{},[20,2113,2116],{"href":2114,"rel":2115},"https:\u002F\u002Famzn.to\u002F3s7fWS3",[24],"Learning Go",[34,2118,2119],{},[20,2120,2123],{"href":2121,"rel":2122},"https:\u002F\u002Famzn.to\u002F3t6PM37",[24],"Go in Action",[11,2125,2126,2127,2132],{},"Liked the article? Consider ",[20,2128,2131],{"href":2129,"rel":2130},"https:\u002F\u002Fwww.buymeacoffee.com\u002FchHAzigTb",[24],"supporting me"," ☕️",[79,2134],{},[11,2136,2137],{},"I hope you learned something new. Feel free to suggest improvements ✔️",[11,2139,2140,2141,2146],{},"I share regular updates and resources on ",[20,2142,2145],{"href":2143,"rel":2144},"https:\u002F\u002Ftwitter.com\u002Fmkfeuhrer",[24],"Twitter",". Let's connect!",[11,2148,2149],{},[15,2150,2151],{},"Keep exploring 🔎 Keep learning 🚀",[2153,2154,2155],"style",{},"html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .s4XuR, html code.shiki .s4XuR{--shiki-default:#E36209;--shiki-dark:#FFAB70}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}",{"title":100,"searchDepth":119,"depth":119,"links":2157},[2158,2163,2168,2169],{"id":84,"depth":119,"text":85,"children":2159},[2160,2161,2162],{"id":89,"depth":126,"text":90},{"id":358,"depth":126,"text":359},{"id":566,"depth":126,"text":567},{"id":1095,"depth":119,"text":1096,"children":2164},[2165,2166,2167],{"id":1102,"depth":126,"text":1103},{"id":1212,"depth":126,"text":1213},{"id":1379,"depth":126,"text":1380},{"id":1621,"depth":119,"text":1622},{"id":2079,"depth":119,"text":2080,"children":2170},[2171],{"id":2099,"depth":126,"text":2100},[67,2173],"Programming","Learn about middlewares, their use cases and how to implement them in Golang applications",false,"md","blog\u002Fgo-middleware\u002Fgo-middleware-card.webp","middleware, golang middleware, golang authentication middleware, golang logging middleware",{},"go-middleware","\u002Fblog\u002Fgo-middleware",{"title":5,"description":2174},"blog\u002Fgo-middleware","2022-03-13","kKWF1CXx-E7_2PpLRJNzev8FCtmbPYmbWg37YXa-_wU",[2187,2194,2200,2208,2217,2223,2230,2237,2243,2249,2255,2261,2267,2273,2280,2286,2292,2298,2304,2310,2316,2322,2324,2331,2338,2344,2350,2356,2362,2368,2374,2380,2386,2392,2398,2404,2410,2416,2423,2429,2435,2441,2448,2454,2460,2467,2474,2480,2487,2493,2500,2506,2513,2519,2525,2531,2537,2543,2549,2555,2561,2567,2573,2579,2585,2592,2598,2605,2611,2617,2623,2630,2636],{"path":2188,"title":2189,"description":2190,"categories":2191,"draft":122,"year":2193,"series":6},"\u002Fblog\u002Fai-assisted-workstation","Building an AI-Assisted Personal Workstation","A living log of building a practical AI-assisted workstation for software and startup work.",[2192,2173],"Productivity","2026-08-08",{"path":2195,"title":2196,"description":2197,"categories":2198,"draft":2175,"year":2199,"series":6},"\u002Fblog\u002Faws-s3-golang","Uploading images to AWS S3 in Golang","In this tutorial I cover how to upload, fetch and manage other operations for objects on AWS S3 in Golang",[67,2173],"2020-01-12",{"path":2201,"title":2202,"description":2203,"categories":2204,"draft":2175,"year":2207,"series":6},"\u002Fblog\u002Fbooks-for-engineers","Best Books for Software Engineers","Best Books to help you build you software engineering career - ranging from fundamentats, interview prep to productivity.",[2205,2206],"Books","Life","2021-12-26",{"path":2209,"title":2210,"description":2211,"categories":2212,"draft":2175,"year":2216,"series":6},"\u002Fblog\u002Fbuilding-acrons","Building Acrons 🚀","Building Acrons, a one-stop tool to decode everyday acronyms like DIY, FOMO, and BRB without losing your flow.",[2213,2214,2215],"Side Projects","Web","Tools","2020-05-26",{"path":2218,"title":2219,"description":2220,"categories":2221,"draft":2175,"year":2222,"series":6},"\u002Fblog\u002Fcap-theorem","CAP Theorem Explained","Learn the concept and misconceptions around popular CAP theorem in system design.",[73,2173],"2021-07-26",{"path":2224,"title":2225,"description":2226,"categories":2227,"draft":2175,"year":2229,"series":6},"\u002Fblog\u002Fcode-reviews","Code Review Checklist","Why code reviews matter, and best practices that catch bugs early and keep code quality high before merge.",[2228],"Engineering Principles","2020-07-20",{"path":2231,"title":2232,"description":2233,"categories":2234,"draft":2175,"year":2236,"series":6},"\u002Fblog\u002Fdark-mode","Add Dark mode to websites","Dark mode is ❤️️ Add it to your websites with little CSS and JS",[2235,2214],"Javascript","2020-07-04",{"path":2238,"title":2239,"description":2240,"categories":2241,"draft":2175,"year":2242,"series":6},"\u002Fblog\u002Fdate-time-golang","Working with Date and Time in Go","Learn how to use time in Golang - Multiple formats, locations and using date.",[67,2173],"2020-10-09",{"path":2244,"title":2245,"description":2246,"categories":2247,"draft":2175,"year":2248,"series":6},"\u002Fblog\u002Fdefer-in-golang","Understanding Defer In Golang","Learn about defer keyword in golang and how it can help you avoid panics due to bugs.",[67,2173],"2021-05-05",{"path":2250,"title":2251,"description":2252,"categories":2253,"draft":2175,"year":2254,"series":6},"\u002Fblog\u002Fenums-golang","Implementing Enums in Golang","Enums are a way to defined set of constant values. Learn how to implement enums in Go using iota with examples.",[67,2173],"2021-12-18",{"path":2256,"title":2257,"description":2258,"categories":2259,"draft":2175,"year":2260,"series":6},"\u002Fblog\u002Fenvironment-variable-golang","Guide to Environment variables in Go","Learn what are environment variables and how to use them in Go",[67,2173],"2020-08-14",{"path":2262,"title":2263,"description":2264,"categories":2265,"draft":2175,"year":2266,"series":6},"\u002Fblog\u002Ferror-handling-golang","Handle errors the right way — Golang","How to handle errors in golang to make your life easy",[67,2173],"2020-01-30",{"path":2268,"title":2269,"description":2270,"categories":2271,"draft":2175,"year":2272,"series":6},"\u002Fblog\u002Ffile-upload-golang","Uploading Files in Golang with Multipart Request","Learn how to upload files from your client to server as a multipart request in Golang.",[67,2173],"2021-03-13",{"path":2274,"title":2275,"description":2276,"categories":2277,"draft":2175,"year":2279,"series":6},"\u002Fblog\u002Fgit-branch","Git Branch 101","Branching is a new path of development that makes it a lot easier to build features. Learn why and how to use branching in git.",[2278,2173],"Git","2022-03-20",{"path":2281,"title":2282,"description":2283,"categories":2284,"draft":2175,"year":2285,"series":6},"\u002Fblog\u002Fgit-pull-request-template","Guide to Pull Request Templates","Improve collaboration and code reviews with pull request templates. Blog include PR template and how to create one on github\u002Fgitlab",[2278,2173],"2023-08-24",{"path":2287,"title":2288,"description":2289,"categories":2290,"draft":2175,"year":2291,"series":6},"\u002Fblog\u002Fgit-remove-sensitive-info","Securing Git: Remove Sensitive Information","Protect your code from security breaches by using BFG tool to remove sensitive information from Git history. Learn how to do it in this comprehensive guide.",[2278,2173],"2023-10-16",{"path":2293,"title":2294,"description":2295,"categories":2296,"draft":2175,"year":2297,"series":6},"\u002Fblog\u002Fgit-tags-explained","Git tags : Explained","What Git tags are, why and when to use them, and how to start tagging releases in your own projects.",[2278,2173],"2020-06-18",{"path":2299,"title":2300,"description":2301,"categories":2302,"draft":2175,"year":2303,"series":6},"\u002Fblog\u002Fgo-dependency-injection","Dependency Injection in Go using Wire","Learn about dependency injection, its benefits and how to implement it in Go services using wire",[67,2173],"2022-11-26",{"path":2305,"title":2306,"description":2307,"categories":2308,"draft":2175,"year":2309,"series":6},"\u002Fblog\u002Fgo-generics","Introduction to Generics in Go","Learn about generics in Golang, it's benefits and how to implement it in applications.",[67,2173],"2022-11-27",{"path":2311,"title":2312,"description":2313,"categories":2314,"draft":2175,"year":2315,"series":6},"\u002Fblog\u002Fgo-in-memory-cache","Building In-Memory Cache in Go","Learn about in-memory caching in Golang, it's benefits and how to implement it with and without generics with a TTL(expiry).",[67,2173],"2024-03-28",{"path":2317,"title":2318,"description":2319,"categories":2320,"draft":2175,"year":2321,"series":6},"\u002Fblog\u002Fgo-makefile","Ultimate Makefile for Golang","Boost your productivity and save time with ultimate Makefile for Golang projects.",[67,2173],"2024-06-10",{"path":2181,"title":5,"description":2174,"categories":2323,"draft":2175,"year":2184,"series":6},[67,2173],{"path":2325,"title":2326,"description":2327,"categories":2328,"draft":2175,"year":2330,"series":6},"\u002Fblog\u002Fgo-naming-conventions","Naming Conventions in Golang","Why naming conventions matter in Go, with best practices and practical examples for clear, readable, maintainable code.",[67,2173,2329],"Code Quality","2023-05-19",{"path":2332,"title":2333,"description":2334,"categories":2335,"draft":2175,"year":2337,"series":6},"\u002Fblog\u002Fgo-with-redis","Go with Redis","A practical introduction to using Redis with Golang to make your applications faster with in-memory data storage.",[67,2336,2173],"Database","2020-05-03",{"path":2339,"title":2340,"description":2341,"categories":2342,"draft":2175,"year":2343,"series":6},"\u002Fblog\u002Fgolang-maps","Learn Maps in Golang (with examples)","A complete guide to maps in Golang: creating maps, adding and removing items, iterating, and how map equality works.",[67,2173],"2020-09-10",{"path":2345,"title":2346,"description":2347,"categories":2348,"draft":2175,"year":2349,"series":6},"\u002Fblog\u002Fguide-to-cdn","Guide to Content Delivery Network","CDN is one of the backbone of modern world internet infrastructure. Learn about Content Delivery Network, it's working, types and benefits.",[73,2173],"2022-01-23",{"path":2351,"title":2352,"description":2353,"categories":2354,"draft":2175,"year":2355,"series":6},"\u002Fblog\u002Fguide-to-rule-engines","Guide to Rule Engines","Rule Engines help in solving changing business requirements with ease. Learn all about Rule engines, it's working, benefits and how to implement one in Golang",[67,2173],"2022-09-12",{"path":2357,"title":2358,"description":2359,"categories":2360,"draft":2175,"year":2361,"series":6},"\u002Fblog\u002Fhexagonal-architecture","Guide to Hexagonal Architecture","Learn how to design efficient application with hexagonal architecture with practical example",[73,2173],"2020-12-13",{"path":2363,"title":2364,"description":2365,"categories":2366,"draft":2175,"year":2367,"series":6},"\u002Fblog\u002Fhttp-status-codes","Learn HTTP Status Codes","A tour of HTTP response status codes, what each class means, and when to use which code in your applications.",[2214,2173],"2020-07-30",{"path":2369,"title":2370,"description":2371,"categories":2372,"draft":2175,"year":2373,"series":6},"\u002Fblog\u002Fintroduction-to-goroutines","Introduction to Goroutines","Understand the basics of concurrency and learn how to work with Goroutines in golang.",[67,2173],"2021-04-10",{"path":2375,"title":2376,"description":2377,"categories":2378,"draft":2175,"year":2379,"series":6},"\u002Fblog\u002Fjson-in-postgres-with-golang","Storing JSON in Postgres with Golang","Learn how to store JSON objects in Postgres and how to implement it in Golang.",[2173,2336,67],"2021-02-13",{"path":2381,"title":2382,"description":2383,"categories":2384,"draft":2175,"year":2385,"series":6},"\u002Fblog\u002Fjson-web-token","Complete Guide to JWT","JSON Web Tokens are a very compact way to carry information. Learn about JWTs in depth, from its structure to when to use it.",[2173,2214],"2021-11-20",{"path":2387,"title":2388,"description":2389,"categories":2390,"draft":2175,"year":2391,"series":6},"\u002Fblog\u002Flearn-to-say-no","Learning to say No","Learn why it's important to say 'NO'. How it helps in increasing productivity and explore strategies for saying No",[2206,2205],"2022-04-09",{"path":2393,"title":2394,"description":2395,"categories":2396,"draft":2175,"year":2397,"series":6},"\u002Fblog\u002Flearn-unlearn-relearn","Learn - Unlearn - Relearn","Unlearning things to learn new is the way to grow. Discover how to do that!",[2192,2206],"2020-09-25",{"path":2399,"title":2400,"description":2401,"categories":2402,"draft":2175,"year":2403,"series":6},"\u002Fblog\u002Flinting-in-golang","Introduction to Linting in Go","Introduction to improving code quality using linting. Learn how to add linting in your Go projects.",[67,2173],"2021-07-07",{"path":2405,"title":2406,"description":2407,"categories":2408,"draft":2175,"year":2409,"series":6},"\u002Fblog\u002Fload-balancing","Load Balancing 101","Complete guide on load balancers explaining the internal working and how does it help in making applications efficient.",[73,2173],"2021-05-29",{"path":2411,"title":2412,"description":2413,"categories":2414,"draft":2175,"year":2415,"series":6},"\u002Fblog\u002Fmaking-decisions-the-right-way","Making Decisions: The right way","Decisions are hard! Learn how to make the right decisions always",[2192,2206],"2020-06-07",{"path":2417,"title":2418,"description":2419,"categories":2420,"draft":2175,"year":2422,"series":6},"\u002Fblog\u002Fmanage-logs-with-logrotate","Using Logrotate to manage logs","Learn how to use logrotate system utility to manage logs with example",[2421,2173],"Linux","2020-09-08",{"path":2424,"title":2425,"description":2426,"categories":2427,"draft":2175,"year":2428,"series":6},"\u002Fblog\u002Fmarshal-structs-golang","Marshal structs the right way: Golang","Why Golang marshals empty structs into your JSON instead of null, and how to marshal structs the right way.",[67,2173],"2020-03-31",{"path":2430,"title":2431,"description":2432,"categories":2433,"draft":2175,"year":2434,"series":6},"\u002Fblog\u002Fnotes-almanack-naval","Book Notes : Almanack of Naval Ravikant","My notes\u002Fhighlights from Almanack of Naval Ravikant book by Eric Jorgenson",[2205,2206],"2020-10-17",{"path":2436,"title":2437,"description":2438,"categories":2439,"draft":2175,"year":2440,"series":6},"\u002Fblog\u002Fnotes-anything-you-want","Book Notes : Anything you want","My notes\u002Fhighlights from Anything you want book by Derek Sivers",[2205,2206],"2021-09-25",{"path":2442,"title":2443,"description":2444,"categories":2445,"draft":2175,"year":2447,"series":6},"\u002Fblog\u002Fnotes-getting-real","Book Notes : Getting Real","My notes and highlights from Getting Real by Jason Fried and David Heinemeier Hansson on building web applications.",[2205,2446],"Startups","2020-11-03",{"path":2449,"title":2450,"description":2451,"categories":2452,"draft":2175,"year":2453,"series":6},"\u002Fblog\u002Fnotes-hell-yeah-or-no","Book Notes : Hell Yeah or No","My notes\u002Fhighlights from Hell Yeah or No book by Derek Sivers",[2205,2206],"2020-09-16",{"path":2455,"title":2456,"description":2457,"categories":2458,"draft":2175,"year":2459,"series":6},"\u002Fblog\u002Fnotes-how-to-be-a-capitalist","Book Notes : How to Be a Capitalist Without Any Capital","My notes\u002Fhighlights from How to Be a Capitalist Without Any Capital by Nathan Latka",[2205,2446],"2020-01-07",{"path":2461,"title":2462,"description":2463,"categories":2464,"draft":2175,"year":2466,"series":6},"\u002Fblog\u002Fnotes-lean-b2b","Book Notes : Lean B2B","My notes and highlights from Lean B2B by Étienne Garbugli on assessing markets, building MVPs, and selling to businesses.",[2205,2465],"Entrepreneurship","2022-07-02",{"path":2468,"title":2469,"description":2470,"categories":2471,"draft":2175,"year":2473,"series":6},"\u002Fblog\u002Fnotes-lets-talk-money","Book Notes : Let's Talk Money","My notes and highlights from Let's Talk Money by Monica Halan on managing personal finances and savings.",[2205,2472],"Personal Finance","2021-02-26",{"path":2475,"title":2476,"description":2477,"categories":2478,"draft":2175,"year":2479,"series":6},"\u002Fblog\u002Fnotes-obviously-awesome","Book Notes : Obviously Awesome","My notes and highlights from Obviously Awesome by April Dunford on product positioning and marketing strategy.",[2205,2446],"2020-04-26",{"path":2481,"title":2482,"description":2483,"categories":2484,"draft":2175,"year":2486,"series":6},"\u002Fblog\u002Fnotes-refactoring-ui","Book Notes: Refactoring UI","My notes and highlights from Refactoring UI by Adam Wathan and Steve Schoger, full of practical design tips for engineers.",[2205,2485],"Design","2020-05-09",{"path":2488,"title":2489,"description":2490,"categories":2491,"draft":2175,"year":2492,"series":6},"\u002Fblog\u002Fnotes-rework","Book Notes: Rework","My notes and highlights from Rework by Jason Fried and David Heinemeier Hansson on a better way to succeed in business.",[2205,2446],"2021-04-14",{"path":2494,"title":2495,"description":2496,"categories":2497,"draft":2175,"year":2499,"series":6},"\u002Fblog\u002Fone-on-one-meetings","Guide to Effective 1:1 Meetings","One on One meetings are important for your personal & professional growth. Learn how to master 1:1s with your manager and peers.",[2498,2192],"Career","2023-03-05",{"path":2501,"title":2502,"description":2503,"categories":2504,"draft":2175,"year":2505,"series":6},"\u002Fblog\u002Fpersonal-okrs","Personal OKRs for Success","Why one should set personal OKRs and how to achieve success with them",[2192,2206],"2020-06-27",{"path":2507,"title":2508,"description":2509,"categories":2510,"draft":2175,"year":2512,"series":6},"\u002Fblog\u002Fpoker-tips","Poker Tips: Johns Hopkins Poker Class","Notes from Johns Hopkins poker course. This guide will help you improve in Poker and win some large pots.",[2206,2511],"Poker","2020-06-13",{"path":2514,"title":2515,"description":2516,"categories":2517,"draft":2175,"year":2518,"series":6},"\u002Fblog\u002Fpomodoro","Get work done: The Pomo Way","Learn to focus and get productive by following the Pomodoro Technique",[2192],"2020-10-24",{"path":2520,"title":2521,"description":2522,"categories":2523,"draft":2175,"year":2524,"series":6},"\u002Fblog\u002Fpostgres-constraints","Postgres Constraints","Constraints are line of defense for database. Explore various types of constrainsts in postgres",[2336,2173],"2020-11-07",{"path":2526,"title":2527,"description":2528,"categories":2529,"draft":2175,"year":2530,"series":6},"\u002Fblog\u002Fppf-explained","PPF Explained","Learn basics about Public Provident Fund and why you should invest",[2206,2472],"2020-12-24",{"path":2532,"title":2533,"description":2534,"categories":2535,"draft":2175,"year":2536,"series":6},"\u002Fblog\u002Fproductivity-chrome-extensions","Boost Productivity with Chrome Extensions","Utitizing chrome extensions to boost your productivity!",[2192,2215,2214],"2020-04-24",{"path":2538,"title":2539,"description":2540,"categories":2541,"draft":2175,"year":2542,"series":6},"\u002Fblog\u002Fproductivity-in-vscode","Improve your productivity with VS Code","Key VS Code features like the integrated terminal, shortcuts, and extensions that improved my everyday productivity.",[2192,2173],"2020-03-12",{"path":2544,"title":2545,"description":2546,"categories":2547,"draft":2175,"year":2548,"series":6},"\u002Fblog\u002Freading-101","Improving Reading 101","Why reading matters, how to build a reading habit, and what to read next - from my own journey into books.",[2205,2206],"2020-04-04",{"path":2550,"title":2551,"description":2552,"categories":2553,"draft":2175,"year":2554,"series":6},"\u002Fblog\u002Freverse-proxy","Understanding Reverse Proxy","Learn about reverse proxy, how it is different from forward proxy and explore advantages of using it in system design.",[73,2173],"2021-10-03",{"path":2556,"title":2557,"description":2558,"categories":2559,"draft":2175,"year":2560,"series":6},"\u002Fblog\u002Frunning-periodic-background-task-golang","Running periodic background tasks in Golang","How to run periodic background tasks in Golang by combining cron-style scheduling with background execution.",[67,2173],"2019-11-21",{"path":2562,"title":2563,"description":2564,"categories":2565,"draft":2175,"year":2566,"series":6},"\u002Fblog\u002Fsessions-in-golang","Sessions using Golang and Redis","How cookies and sessions work, and how to implement persistent login sessions in Golang using Redis.",[67,2336,2173],"2020-02-25",{"path":2568,"title":2569,"description":2570,"categories":2571,"draft":2175,"year":2572,"series":6},"\u002Fblog\u002Fsolid-dry-kiss-yagni","Solid Dry Kiss Yagni","An introduction to the SOLID, DRY, KISS, and YAGNI principles and how they help you write cleaner, robust code.",[2228],"2020-07-17",{"path":2574,"title":2575,"description":2576,"categories":2577,"draft":2175,"year":2578,"series":6},"\u002Fblog\u002Fstack-in-golang","Implement Stack in Golang","Learn how to implement stack data structure in Golang (Full code)",[67,2173],"2020-09-14",{"path":2580,"title":2581,"description":2582,"categories":2583,"draft":2175,"year":2584,"series":6},"\u002Fblog\u002Fstart-oss-today","Start your Open Source journey today","Start your OSS journey with intro to GIT. Participate in Hacktoberfest!",[2278,2173],"2020-09-19",{"path":2586,"title":2587,"description":2588,"categories":2589,"draft":2175,"year":2591,"series":6},"\u002Fblog\u002Fsticky-social-bar","Sticky social share component in HTML","Learn how to build a social media sharing component in HTML and add it to your website.",[2173,2590],"Frontend","2021-02-05",{"path":2593,"title":2594,"description":2595,"categories":2596,"draft":2175,"year":2597,"series":6},"\u002Fblog\u002Fterm-insurance","Term insurance Simplified","Everything you need to know before you buy a term insurance.",[2206,2472],"2020-11-29",{"path":2599,"title":2600,"description":2601,"categories":2602,"draft":2175,"year":2604,"series":6},"\u002Fblog\u002Fterminal-output-with-redirection","Handling terminal outputs with Redirection","Learn how to handle terminal outputs with Redirection and saving it to files",[2421,2603,2173],"Terminal","2020-09-06",{"path":2606,"title":2607,"description":2608,"categories":2609,"draft":2175,"year":2610,"series":6},"\u002Fblog\u002Fthink-and-grow-rich","Book Notes: Think and Grow Rich","My notes and highlights from Think and Grow Rich by Napoleon Hill, covering its process for building wealth.",[2205,2206],"2020-05-19",{"path":2612,"title":2613,"description":2614,"categories":2615,"draft":2175,"year":2616,"series":6},"\u002Fblog\u002Ftransactions-postgres-golang","Transactions on Postgres with Golang","Performing Postgres database operations in Golang with GORM, from basic queries to full transaction support.",[67,2336,2173],"2020-03-18",{"path":2618,"title":2619,"description":2620,"categories":2621,"draft":2175,"year":2622,"series":6},"\u002Fblog\u002Fwaitgroups-in-golang","WaitGroups in Golang","Learn about WaitGroups in golang and how to use them to perform concurrent operations without blocking the main thread.",[67,2173],"2022-05-31",{"path":2624,"title":2625,"description":2626,"categories":2627,"draft":2175,"year":2629,"series":6},"\u002Fblog\u002Fwhat-i-use","What I Use: Products and Softwares","List of what I use in my day to day life ranging from terminal, editors, softwares, devices to accessories",[2206,2628],"Tech","2024-06-01",{"path":2631,"title":2632,"description":2633,"categories":2634,"draft":2175,"year":2635,"series":6},"\u002Fblog\u002Fyear-in-review-2020","Year in Review: 2020","It's a wrap! 2020 was a crazy year, See how my year went!",[2206],"2020-12-31",{"path":2637,"title":2638,"description":2639,"categories":2640,"draft":2175,"year":2641,"series":6},"\u002Fblog\u002Fyear-in-review-2021","Year in Review: 2021","It's a wrap! 2021 was a mixed bag, full of ups and downs. Key Goal for 2022: Start now!",[2206],"2021-12-31",1787743427864]