Skip to content

About

Example project demonstrating tips for writing web servers in Go

Topics

Resources

Stars

38 stars

Watchers

2 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-web-server-tips

This project demonstrates some code practices I use when writing web servers in Go.

To start, run:

go run main.go

Blog post: dev.to/chidiwilliams/writing-cleaner-go-web-servers-3oe4

Tips

  • Use clean architecture

    • Good code organization/folder structure
    • Decouple dependencies
  • Extend HTTP handler

    • Handle errors in one location
  • Standardized response format

  • Create custom errors for client errors

    • Clean error handling
  • ozzo-validator with custom validator?

    • Struct validation outside controller
  • Integration testing with testify?

About

Example project demonstrating tips for writing web servers in Go

Topics

Resources

Stars

38 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages