Booking options
£82.99
£82.99
On-Demand course
6 hours 44 minutes
All levels
Master Go programming with an in-depth course covering advanced topics such as authentication, authorization, JWT tokens, and refresh tokens. Learn how to write reliable code with effective unit testing techniques, while exploring concepts such as logging, error handling, and modularization. Build secure and scalable web applications with Go to take your coding expertise to the next level.
If you are looking to take your programming skills to the next level, Go programming is a must-know language in today's tech landscape. This powerful language has gained widespread popularity due to its simplicity, performance, and scalability. In this comprehensive course, you will dive deep into Go programming and learn how to build efficient and scalable microservices using REST-based APIs. In this course, you will start with an in-depth exploration of security, covering best practices for securing your applications. You will learn about authentication and authorization strategies, how to implement role-based access control, and generate JWT tokens for secure user management. Next, you will delve into unit testing techniques for writing reliable and robust code. You will understand state-based testing, testing routes, and services, and learn the difference between mocks and stubs. You will also explore how to generate mocks and rewire applications for effective unit testing. In addition, this course covers logging and error handling, critical aspects of building robust applications. You will learn how to extract logger and AppError packages from your project to create a Go module for better code organization and reusability. You will also discover how to modularize your code with the banking-lib module, integrating it into your banking API and banking-auth API. You will refactor your code to use Claims domain objects for parsing JWT tokens and understand the concept of refresh tokens for maintaining secure access to your applications. By the end, you will gain the skills needed to build secure and reliable Go applications, optimize code organization, and elevate your coding expertise.
Learn to build REST-based microservices APIs using Go
Implement logging and error handling in Go applications
Create modular and reusable code with Go modules
Understand how to integrate external packages into Go projects
Implement refresh token functionality for secure authentication in Go
Refactor and optimize Go code for efficient microservices development
This course is for developers looking to level up their skills in Go programming and learn about REST-based microservices API development. It's also suitable for college students learning Golang and experienced developers new to Go and microservices. Whether you are a software developer, web developer, or IT professional, this course provides the knowledge, examples, and best practices to excel in your career.
This course takes a practical, hands-on approach to learning REST-based microservices API development with Go. Through comprehensive video lessons, real-world examples, and coding exercises, you will build practical skills and knowledge to develop microservices applications using Go, gain confidence in your coding abilities, and apply best practices for efficient microservices development.
Learn REST-based microservices API development in-depth, including testing, routing, services, authentication, logging, and advanced topics * Practical, hands-on approach with real-world examples and coding exercises * Emphasis on best practices for efficient microservices development in Go
https://github.com/PacktPublishing/Building-Microservices-API-in-Go
Ashish Juyal is a passionate all-round IT consultant with nearly two decades of experience in IT, specializing in cloud computing, continuous delivery, and DevOps. As a principal architect, Ashish has successfully translated technical and organizational challenges into solutions for multiple enterprise customers. He is well-versed in agile team methodologies, XP engineering practices, and has contributed to design, coding, code optimization, testing strategies, and integration techniques. Ashish has a strong drive for gaining and sharing knowledge and has coached development teams ranging from small start-ups to enterprise-sized companies. He has in-depth expertise in design patterns, domain-driven design, application integration, distributed application architecture, and object-oriented modeling and design.
1. Introduction
1. Welcome to the Course In this video, we will introduce the course and discuss its objectives, giving you an overview of what to expect in the upcoming lessons. |
2. Getting Started In this video, we will cover the necessary tools required for developing REST-based microservices APIs in Go, including setting up your development environment and understanding the tools that will be used throughout the course. |
2. Router Basics
1. Hello World In this video, we will dive into the basics of building an HTTP web server in Go using the standard HTTP library. We will cover topics such as request multiplexer (router) and handler functions, and how to register endpoints with the default multiplexer to handle incoming requests. |
2. JSON Encoding In this video, we will explore how to encode Go structs to JSON representation and set response headers. We will cover topics such as marshalling data structures to JSON and working with response headers to control the content sent back to clients. |
3. XML Encoding In this video, we will delve into encoding Go structs to XML representation and handling request headers. We will cover topics such as encoding structs to XML, extracting content type headers from incoming requests, and adding XML and JSON tags to struct fields. |
4. Refactoring and Go Modules In this video, we will focus on refactoring and structuring our application. We will introduce Go modules as a way to manage dependencies and improve code organization, including cleaning up our code and giving structure to our application. |
5. gorilla/mux In this video, we will explore the capabilities of the popular gorilla/mux library for routing in Go. We will cover topics such as its routing capabilities and how to use it to build more complex APIs with advanced routing features. |
3. Application Development
1. Introduction to Hexagonal Architecture In this video, we will explore the principles and concepts of hexagonal architecture, including ports and adapters, and how it can be used to design flexible and maintainable applications in Go. |
2. Implementing Hexagonal Architecture In this video, we will take a practical approach to implement the hexagonal architecture in our banking application, starting with setting up the application structure and understanding the key components of the architecture. |
3. Database Adapter In this video, we will focus on building a database adapter for our Go application, including setting up a MySQL connection pool, implementing the repository pattern, and injecting dependencies at the time of application wiring. |
4. Error Handling Part 1 In this video, we will cover error handling in our application, including retrieving a single customer from the server-side and handling errors that may occur. |
5. Error Handling Part 2 In this video, we will continue our discussion on error handling, including setting up an error handling infrastructure and handling internal server errors and not found errors. |
6. Refactor Error Handling In this video, we will focus on improving the design of our error handling by implementing best practices and making our error handling more robust and maintainable. |
7. Assignment 1: Fix GetAllCustomers API In this assignment video, we will work on fixing the GetAllCustomers API by implementing the acceptance criteria, including returning JSON response, handling unexpected errors with appropriate HTTP status code, and returning data for successfully retrieving customers from the server-side. |
8. Assignment Solution: Fix GetAllCustomers API In this solution video, we will review the solution for the GetAllCustomers API assignment and discuss the best practices for implementing the required functionality. |
9. Assignment 2: Enhance GetAllCustomers API In this assignment video, we will focus on enhancing the GetAllCustomers API by adding the ability to fetch customers by status and discuss the implementation details and best practices. |
10. Assignment Solution: Enhance GetAllCustomers API In this solution video, we will review the solution for the Enhance GetAllCustomers API assignment and discuss the best practices for implementing the required functionality. |
11. Structured Logging In this video, we will discuss the importance of structured logging in application development and introduce the popular logging library uber/zap for implementing structured logging in our Go application. |
12. Sqlx In this video, we will introduce Sqlx, a popular library for database operations in Go, and demonstrate how to refactor our server-side layer to use Sqlx for improved database interactions. |
13. Data Transfer Object In this video, we will explore the concept of Data Transfer Objects (DTOs) and how they can help decouple the domain from the application layer. We will discuss the benefits of using DTOs and how to implement them in your application. |
14. Application Configuration In this video, you will learn how to manage application configuration using environment variables. We will discuss best practices for handling configuration in your application and how to securely store sensitive information such as API keys and database credentials. |
15. New Bank Account: Part 1 In this video, we will dive into the implementation of a new bank account feature in our banking application. We will discuss the concept of domain and secondary ports, and how to implement them in our application design to ensure separation of concerns and maintain a clean architecture. |
16. New Bank Account: Part 2 In this video, we will continue building the new bank account feature in our banking application. We will focus on the implementation of the POST verb and incoming request validation for creating a new bank account. We will also discuss error handling and best practices for handling invalid requests. |
17. Assignment 3: Make a Transaction in Bank Account In this assignment video, we will tackle a real-world scenario of making a transaction in a bank account. We will write an API to create a new transaction for an existing customer, including validation of transaction types, amount, and available balance. We will also discuss error handling and appropriate HTTP status codes for different scenarios. |
18. Assignment Solution: Make a Transaction in Bank Account In this solution video, we will work on the solution for the assignment on making a transaction in a bank account. We will review the implementation and discuss best practices for handling transactions, error handling, and ensuring data integrity in the banking application. |
4. Security
1. Securing Application In this video, we will discuss the authentication and authorization strategy we will be implementing in this section. We will explore the importance of securing our application and discuss best practices for implementing effective authentication and authorization mechanisms. |
2. JWT Tokens In this video, we will introduce JWT tokens and discuss how to store claims inside the token. We will also cover the concept of token validity and discuss best practices for managing JWT tokens in our application. |
3. Auth Server: Login API In this video, we will implement the authentication server and focus on the implementation of the login API. We will cover topics such as user roles, defining role-based access control, and generating tokens after successful authentication. |
4. Auth Server: Verify API In this video, we will introduce a middleware component for verifying API authorization using the token. We will cover best practices for implementing token-based authentication and authorization in our application, ensuring the security and integrity of our APIs. |
5. Unit Testing
1. Unit Testing: State-Based Test In this video, we will cover the basics of unit testing and discuss state-based testing. You will learn what to test and how to write effective state-based tests. We will also discuss the importance of shorter feedback loops in the development process and how unit testing can help achieve that. |
2. Unit Testing: Testing Routes In this video, we will explore the responsibilities of components for unit testing and discuss the differences between mocks and stubs. You will learn how to generate mocks and rewire our application using mocks for unit testing routes. We will also cover best practices for writing unit tests for routes and ensuring their reliability. |
3. Unit Testing: Testing Services In this video, we will focus on unit testing services and mocking server-side components. You will learn how to effectively write unit tests for services and improve the readability of our code through refactoring after the tests. We will also cover techniques for making the new account service better and more reliable. |
6. Advanced Topics
1. Introduction In this video, we will provide an overview of the advanced topics covered in this section. We will introduce the concepts and techniques that will be covered in the subsequent videos. |
2. Logger and AppError as Go Module In this video, you will learn how to extract the logger and AppError package from the existing banking project and create a Go module out of it. We will discuss best practices for creating reusable modules and how to integrate them into other projects for improved code organization and maintainability. |
3. banking-lib Module in Banking API In this video, we will explore the process of integrating the banking-lib module into the banking API. You will learn how to leverage the functionalities provided by the banking-lib module to enhance the functionality of the banking API. |
4. banking-lib Module in Banking Auth In this video, we will discuss how to integrate the banking-lib module into the banking-auth API. You will learn how to leverage the functionalities provided by the banking-lib module to improve the authentication and authorization functionalities of the banking-auth API. |
5. Refactoring the Verify API In this video, we will focus on refactoring the Verify API using the Claims domain object while parsing JWT tokens. You will learn how to improve the code design and maintainability by encapsulating token-related functionalities in domain objects. |
6. Refresh Token: Introduction In this video, we will introduce the concept of refresh tokens. We will discuss their purpose and benefits in modern authentication and authorization workflows. |
7. Generating Refresh Token: Part 1 In this video, we will structure our application for generating a refresh token. We will create a small design to accommodate the refresh token in the login flow and discuss best practices for handling refresh tokens securely. |
8. Generating Refresh Token: Part 2 In this video, we will continue from where we left off in the previous video and learn how to generate refresh tokens. We will discuss different strategies and techniques for generating secure refresh tokens in our application. |
9. Refreshing an Access Token In this video, we will cover the process of generating a new access token from a refresh token. We will discuss how to implement token refreshing in our application to ensure uninterrupted user sessions and improved security. |