Go (Golang) REST API Example (Without Framework)

preview_player
Показать описание
The Go (Golang) standard library offers a vast amount of primitives that can be applied to a variety of problems. One of them is the HTTP ServeMux, which is a request multiplexer and allows us to map a set to requests into handlers. By the end of this video we are going to:

- See how to implement a simple REST API just with the Go standard library
- Use the Go ServeMux type to route requests to handlers
- Use minimal scaffolding to implement a basic JSON REST API

The ServeMux type is the main component of our API as it allows us to route set of requests into handlers based on the request pattern. Although the pattern matching is limited and we have to do a fair amount of work to map requests to handlers based on regular expressions and http methods, we can easily add the missing pieces with little extra work

Рекомендации по теме
Комментарии
Автор

Thanks so much for the vid! With so many frameworks going around it's nice to find materials to learn the fundamentals :)

thesuker
Автор

Fantastic tutorial! I now have a working REST API. Now to go through the code and study it to make sure I fully understand it all!

aaronking
Автор

Excellent tutorial! Should definitely have more views 👏

gergelynemeth
Автор

Thanks for the tutorial! Question: what is the reasoning behind using a pointer to userHandler when userHandler contains only one field which is a pointer to datastore? Same goes for datastore: why does it contain a pointer to sync.RWMutex when datastore itself is accessed/modified via a pointer already? Thanks!

impaque
Автор

Great tutorial, how did you set up that editor, I love it

evicoach
Автор

Awesome, keep up the good work! are you from italy by the way?

upsurgecerberus