DEV Community

Cover image for Go interview task example -  REST API
Henryk Konsek
Henryk Konsek

Posted on

Go interview task example - REST API

Here is a sample application specification I use as a base for Go interviews. It's pretty simple to write and I use it as a foundation for further conversations with a candidate.

Task specification

  • create simple Go application exposing REST API
  • no specific web framework is required to be used
  • when /api/weather endpoint is called, fetch weather alerts data for the state of New York using this API
  • read weather alerts headlines from the api.weather.gov API response (JsonPath $.features[*].headline)
  • return alerts headlines in a similar response:
{"alerts": ["Wind Chill Advisory issued February 12 at 4:02AM EST until February 12 at 10:00AM EST by NWS Binghamton NY"]}
Enter fullscreen mode Exit fullscreen mode

Extra points

It is up to you how simple or complex the application will be. However you can treat this application as an occasion to brag about the things you know. For example:

  • Do you like unit testing? Go for it and show us your favorite testing libraries in action!
  • Docker fan? Dockerize the application then and include your Dockerfile!
  • Any other cool libraries you know and wanna show us? Let us learn from you!

Top comments (5)

Collapse
 
shindakun profile image
Steve Layton

Happened to see this while looking through recent posts and figured what the heck. I went for very simple with the standard library, a Dockerfile, and no tests. Threw them up as a gist.

gist.github.com/shindakun/4ebd21c2...

Collapse
 
hekonsek profile image
Henryk Konsek

Thank you Steve! I love it.

+1 for how you use Go Docker image and Docker stages to build project! I see this build in stage pattern being more and more popular for cloud native applications. It makes total sense for me!

BTW Is there any reason to set up GOPROXY? I guess it defaults to https://proxy.golang.org anyway?

PS I will try to comment more later!

Collapse
 
shindakun profile image
Steve Layton

Thanks! The GOPROXY is really just left over from and older revision, it does not need to be in there any longer as far as I know.

Collapse
 
mariumaz profile image
Myriam Azzouz

Hey Steve :) , Why did you use docker in this task, could we just use go run ? Thanks !

Collapse
 
mariumaz profile image
Myriam Azzouz

Hello Henryk, is there a way to know all the possible states ?
Thanks !