I need help
https://tenor.com/en-GB/view/hey-there-turn-around-sassy-fabulous-hair-flip-gif-16899626

I need help

Every now and then, I get curious. Curious to see what is Back End development looks like from my RGB gradient front end glasses that blinks “JS DEV ! Proceed with Caution”. This time it was Golang.

So I need your help :) What would be the 3 things you would change to follow best practices when it comes to code structure in golang and architechture ?

What are we even building ?

Nothing fancy. Small CRUD API.

We have tasks and assignees. You can:

  • Add a task
  • Remove a task
  • Assign people to a task
  • Get next assignee from the task
  • Remove people from the task


Database, API and Services ??

  • We should be able to swap DB’s easily if needed
  • API layer will handle request validation and response formatting
  • Service layer (store in my case) should include all bussiness logic
  • Types should hold db - structure
  • Main entry point should init one db reference and server.


Show me

├── README.MD
├── api
│   ├── server.go
│   └── task.go
├── config
│   └── config.go
├── service
│   └── task_service.go
├── storage
│   ├── mongo.go
│   └── storage.go
└── types
│   └── task.go
├── go.mod
├── go.sum
├── main.go
        

Code here


Tell me

Is this scalable ? Is this following golang's best practices ? What would you do differently ? Give me hand



要查看或添加评论,请登录

Mehmet Ali Izci的更多文章

  • Pimp your github profile

    Pimp your github profile

    Howdy ho ! This article might help giving you an edge when getting hired as a softwar dev. It is about low-investment /…

    1 条评论

社区洞察

其他会员也浏览了