Skip to content

Latest commit

 

History

History
52 lines (35 loc) · 1.69 KB

File metadata and controls

52 lines (35 loc) · 1.69 KB

go-course

This is a hands-on async course/workshop for learning how to build APIs with Go.

How to participate in this course:

  1. Fork this github repository.
  2. Start implementing the services step by step.

1. Todo API

We are going to implement an API that manages TODOs.
Think of it as the backend for something like this: https://reactjsexample.com/github-lilia-obushenko-todo-react-app/

// example
type MyRepo interface {
	Create(todo model.Todo) error
	Get(name string) (model.Todo, error)
}

type InMemRepo struct {
	...
}
  • Unit test your repo layer. https://go.dev/doc/tutorial/add-a-test

  • Implement service layer. Service layer has access to repo/ methods (via the interface) to perform at least the following operation Get Or Create.

  • Unit test your service layer.

  • Unit test your API layer. Yes, now that you have experience writing unit tests, first write the tests then write the code, TDD!.

  • Implement api layer. API layer does not has access to any other package (service interface is defined under API layer). https://gobyexample.com/http-servers

  • Initialize everything under cmd/todoapi/ and start the http API.

Ask help/questions in telegram @eoozs