https://github.com/chidiwilliams/go-web-server-tips
Example project demonstrating tips for writing web servers in Go
https://github.com/chidiwilliams/go-web-server-tips
buntdb clean-architecture clean-code code-organization go mongo mongodb template
Last synced: 9 months ago
JSON representation
Example project demonstrating tips for writing web servers in Go
- Host: GitHub
- URL: https://github.com/chidiwilliams/go-web-server-tips
- Owner: chidiwilliams
- Created: 2020-04-28T13:47:30.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-05-01T17:35:36.000Z (over 5 years ago)
- Last Synced: 2025-02-28T08:29:50.546Z (10 months ago)
- Topics: buntdb, clean-architecture, clean-code, code-organization, go, mongo, mongodb, template
- Language: Go
- Homepage: https://dev.to/chidiwilliams/writing-cleaner-go-web-servers-3oe4
- Size: 10.7 KB
- Stars: 36
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# go-web-server-tips
This project demonstrates some code practices I use when writing web servers in Go.
To start, run:
```shell script
go run main.go
```
Blog post: [dev.to/chidiwilliams/writing-cleaner-go-web-servers-3oe4](https://dev.to/chidiwilliams/writing-cleaner-go-web-servers-3oe4)
## Tips
- [x] Use clean architecture
- Good code organization/folder structure
- Decouple dependencies
- [x] Extend HTTP handler
- Handle errors in one location
- [x] Standardized response format
- [x] Create custom errors for client errors
- Clean error handling
- [ ] ozzo-validator with custom validator?
- Struct validation outside controller
- [ ] Integration testing with testify?