
Learn to build a go-based gRPC API using language-specific clients to call server endpoints, in a relaxed, collaborative course with environment setup in the next video.
Set up your Golang gRPC environment by installing dependencies, generating code from proto files with protoc, and organizing generated files into pdb and v1 folders.
Install and configure MySQL as part of your environment, alongside Go extensions and code snippets in Visual Studio Code, then prepare migrations and repositories for the backend.
Set up a version-controlled database migration workflow to create a users table with id, email, password, first_name, last_name, and is_visible, using up and down migrations.
Set up go modules and dependency management, then define the user type as a model with id, email, first name, last name, and password, including json tags and schema validation.
Implement user type validation by using the validator package and tags, creating validate_tor.go, and applying a validate function to enforce required fields like first name, last name, and password.
Create a global repo singleton to manage API and MySQL database interactions via the xorm repository package, and inject it into gRPC handlers for data access.
Create a users repo to query data from the database and wire it into the global repo. Implement the users repo type and its constructor, then prepare for first functionalities.
Implement the create function in the users repository to store a new user, validating first name, last name, email, and password, and inserting via the X form insert function.
Develop find by id and find by email in the UsersRepo, returning a user pointer and error, with input validation and a database lookup by id or email.
Implement the users repository update function with input validation, perform the db update, and return errors for invalid input. Discuss the affected rows concept.
Set up the test environment with Ginkgo and Gomega and bootstrap the test suite. Use query marking to mock database interactions and verify expectations like truncating users with Gomega assertions.
Learn to write unit tests for a golang gRPC API by using mocks to simulate sql interactions, covering validation, database errors, and test coverage with ginkgo and gomega.
Test without mocking the database by using a live database and a valid connection to verify real queries. Create a branch and push changes.
Explore unit tests for the users repository, implementing FindById and FindByEmail with sqlmock, covering success paths, database errors, and zero-row scenarios.
Generate repository mocks for testing the Golang gRPC API, injecting data and replacing real repo calls. Create a mock generator script and integrate mocks into handlers across repos.
Learn to generate mocks for repos and enable full-scale testing of your Go gRPC API using a mocking framework and a bash script to automate repo mocks.
Discover how protobufs and protoc generate code in Go, C++, and Java from proto definitions, along with mocks, using a Makefile and plugins to build gRPC endpoints.
Define protobuf types in a types.proto file. Create a user message with first name, last name, and email, omitting password in responses, and generate Go code using protoc.
Create a v1 user service with protobuf rpc endpoints for create user, find by id, find by email, and update user, using request and reply messages and the user type.
Extend the protobuf auth service in the golang gRPC API by copying user types, adding a login request and login reply; login accepts email and password and returns a token.
Explore building gRPC endpoints with interceptors, and implement helper functions to attach and retrieve a global repo in request context for authentication and routing.
Implement a gRPC interceptor that injects a singleton global repo into server requests via context for dependency injection and model access, focusing on unary calls and the distinction from streaming.
Scaffold the gRPC users handler under v1, defining create, find by phone, find by email, and update operations with context-aware requests and user replies.
Develop and validate the gRPC users create endpoint in Go, wiring a global repo, context usage, and comprehensive user validation for email, first name, last name, and password.
Builds tests for the gRPC users handler create operation, bootstraps mocks and repositories, and validates error handling and successful user creation.
drive a second test for the gRPC users create handler to achieve 100 percent test coverage by manipulating the global repo in context, validating error handling with a valid user.
Finish three gRPC user routes by adding id and email lookups via the global repo, validate updates, enforce password policies, and ensure data integrity with full test coverage.
finish writing tests for the gRPC users handler to achieve 100 percent coverage, validating find by email, find by ID, and update functions in the Golang gRPC API course.
Run a gRPC api server from the command line, expose v1 users endpoints, configure interceptors and a docker container workflow, and test the service via net.Listen on a port.
install grpc_cli to test your golang gRPC API endpoints, configure the reflection service to reveal available endpoints like v1 users.
Use grpc_cli to create a new user in the database via gRPC, passing a data object with first name, last name, email, and password, noting the unique constraint on email.
Create the author repo to manage JWT-based authentication and token data for protected routes in the Golang gRPC API, testing with gRPC tools.
Implement a GetNewClaims function in the auth repo returning a new JWT claims object with a subject and data map.
Generate a signed token from a claims object to enable authentication after login, using jwt claims with issued, not-before, and seven-day expiry, then sign and retrieve token data.
Extract data from a token by decrypting and validating JWT claims, parse user id, email, and visibility, and return a user object in the auth repo workflow.
Create and refine test files for the auth repository, generate mocks and marks, and run gingko and go tests to validate repository tests and user tests.
Explore how to flesh out auth tests in the repo, covering get new claims, get signed token, and extract data from token, using mocks and test cases to boost coverage.
Watch the testing video to add the required item to your global repo, ensuring access to the rest of the videos for the Golang gRPC API course.
Build and test a gRPC login endpoint using JWT authentication in Go, validating login requests, verifying user credentials, and returning a signed token with claims.
Create and configure a new test file for the auth handler using Ginkgo bootstrap, wire up router and server references, and prepare the testing setup for the Go gRPC API.
Build and refine unit tests for the login flow in Golang, covering invalid requests, global and user repos, error handling, and token generation.
Add auth endpoints to the Go gRPC API and wire them into the server by initializing V1 routes. Run the server and prepare tests to validate the new routes.
Test the login auth endpoint in a Golang gRPC API by verifying authentication, using a sample user and credentials, and validating the service response.
Explore how gRPC authentication works in Go, focusing on passing data through parameters and returns to endpoints, and how tokens, JWTs, and validation shape secure remote calls.
Learn to secure a Golang gRPC API by adding a JWT field to routes and implementing interceptors to enforce authentication on sensitive operations like read and update.
Add authentication checks in the interceptor using reflection to extract a jwt token from gRPC requests, set user context, and validate flow through tests.
Discover why touching the users tests isn't required after authentication, as router-level tests pass and interceptors manage authentication independently of routes; learn to add user to test context when needed.
Learn how to run a full test suite with Ginkgo, executing all tests in your main folder, and understand when to use full suite tests versus individual tests.
Connect a Go gRPC backend to a VueJS frontend using a GOPAC web proxy and build a JavaScript client with npm to test a login flow.
In this course, you will learn how to create gRPC API's using Golang. You will learn production ready techniques to put you at the top of Golang gRPC programmers. We will learn how to get 100% coverage from all of our models and endpoints. We will also build unary and stream interceptors. We will also explore sqlmock and how it can help us achieve 100% coverage. We will build our own mock files from our models. Come and explore the new and excited gRPC with me!
I've added a lecture on querying gRPC services using VueJS and gRPC-web.