willianpc / go-sample-app

A Go Sample App Intended to be instrumented

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Go Sample App

A simple Go application which contains the following features:

  1. Acts as an HTTP client
  2. Acts as an HTTP server
  3. Makes use of Redis for caching

What it does

  1. The application exposes a web server that receives a querystring q as its only argument.
  2. The string provided for q will be used to query Google.
  3. The results from the first page are then filtered and all titles of results are returned in a JSON format.
  4. The result is then cached in Redis for 15 seconds.
  5. If the same query is made within 15 seconds, the data is retrieved from Redis instead of querying Google again.

How to start the application

Start Redis

$ docker compose up -d

Start the application

$ go run .

Running the application

  1. Call the URL http://localhost:9090/query?q=myquery

About

A Go Sample App Intended to be instrumented

License:MIT License


Languages

Language:Go 92.8%Language:Dockerfile 4.8%Language:Makefile 2.4%