All Posts


API for different queries Sample data (data.json) { “name”:“computers”, “description”:“List of computer products”, “prices”:[2400, 2100, 1200, 400.87, 89.90, 150.10], “names”:[“John Doe”, “Jane Doe”, “Tom”, “Jerry”, “Nicolas”, “Abby”], “items”:[ { “id”:1, “name”:“MacBook Pro 13 inch retina”, “price”:1350 }, { “id”:2, “name”:“MacBook Pro 15 inch retina”, “price”:1700 }, { “id”:3, “name”:“Sony VAIO”, “price”:1200 }, { “id”:4, “name”:“Fujitsu”, “price”:850 }, { “id”:null, “name”:“HP core i3 SSD”, “price”:850 } ] }

Query JSON data using Golang (gojsonq package)

Most often developer needs to consume JSON data from other service and query over them. Querying JSON data is little time consuming. For the last few days I was working on a package for Golang to query JSON data easily. The idea and inspiration comes form PHP-JSONQ by Nahid Bin Azhar. Lets take a sample JSON data to start with: Now we are ready to query the data, lets see some examples

How to customize Laravel request throttle message in API response?

When you are using laravel api, then you must use throttling to protect your api from scrapping or any other attack. When you are limiting your api using laravel throttle then you get a html response message containing “Too Many Attempts.” In order to change the message in a custom format and json reponse follow the steps below: Create a new file ThrottleRequestsMiddleware.php in __ app/Http/Middleware/__ and paste the code below:

Let’s make a simple todo app with Go

Generally Go is perfect for building micro services, but it doesn’t mean that trivial MVC app are not easy to build. Go has built-in support for parsing html template, though we are not going to focus on that. First of all let’s write our go code for serving a html page and save it in a directory. In our case let’s call the directory todoapp and create a home.tpl file inside it.

An easy way to validate Go request

When building REST API or web applications using Go, an essential part is to validate the incoming request data. I have worked in some small and medium project in Golang, most of them are micro-services, providing restful api. I have used different way to validate incoming data. Lets start with particular one that I use frequently. For validating application/json or text/plain request, first I build a struct type of that particular request and add a validate method on the struct.

Build RESTful API service in golang using gin-gonic framework

Today I’m going to build a simple API for todo application with the golang programming language. I’m going to use golang simplest/fastest framework gin-gonic and a beautiful ORM gorm for our database work. To install these packages go to your workspace $GOPATH/src and run these command below: $ go get $ go get -u $ go get In generic crud application we need the API’s as follows:

Code for coffee time

What to read in your favorite coffee time? Don’t worry, I’ll try to make your coffee time more interesting. Hope that will worth your time :) As yo already know I am a new born gopher, I love this language so much, thats the reason I’ll try to write in my free time. I am interested to write not only Go but also some other cool tech staff