How To Create Golang REST API: Project Layout Configuration [Part 2]by@danstenger
2,992 reads

How To Create Golang REST API: Project Layout Configuration [Part 2]

tldt arrow
Read on Terminal Reader
Read this story w/o Javascript

Too Long; Didn't Read

The Go application is now running in docker, can respond to code changes and reload for instant feedback. For handling http requests I will add another dependency, http router (mux) This is a lightweight, high performance HTTP request router that is easy to use and has everything most API's will need. I define all my routes in go/go and call handlers by explicitly passing application configuration so that each handler has access to things like database, configuration with env vars and more. I keep my handlers separate from router and group them under sub folders.

Company Mentioned

Mention Thumbnail
featured image - How To Create Golang REST API: Project Layout Configuration [Part 2]
Daniel HackerNoon profile picture

@danstenger

Daniel


Receive Stories from @danstenger

react to story with heart

RELATED STORIES

L O A D I N G
. . . comments & more!
Hackernoon hq - po box 2206, edwards, colorado 81632, usa