Go for Newbies: Concurrent API Backend
Build high-performance, concurrent API backends in Go, even with no prior experience!
...
Share
Introduction to Go and the Development Environment
Unit 1: Setting Up Your Go Environment
Meet Go: An Intro
Installing Go
Configuring Go
Your First Go Program
Running Go Programs
Unit 2: Go Syntax and Basic Data Types
Go Syntax: Overview
Variables in Go
Basic Data Types
Constants in Go
Operators in Go
Unit 3: Control Flow and Package Management
If-Else Statements
For Loops
Switch Statements
Go Modules: Intro
Using External Packages
Understanding Concurrency: Goroutines
Unit 1: Concurrency Fundamentals
What is Concurrency?
What is Parallelism?
Concurrency vs Parallelism
Why Use Concurrency?
Concurrency Challenges
Unit 2: Introduction to Goroutines
What are Goroutines?
The `go` Keyword
First Goroutine Example
Waiting for Goroutines
Number of Goroutines
Unit 3: Goroutine Management
Passing Data to Goroutines
Goroutine Gotchas
Goroutines and Closures
Goroutine Scheduling
Best Practices
Communication and Synchronization: Channels
Unit 1: Introduction to Channels
What are Channels?
Declaring Channels
Sending and Receiving
Closing Channels
Channel Direction
Unit 2: Buffered vs. Unbuffered Channels
Unbuffered Channels
Buffered Channels
Buffered vs Unbuffered
Channel Capacity
When to Use Buffered
Unit 3: Synchronization Patterns
The Done Channel
Select Statement
Timeout with Select
The Quit Channel
Fan-out, Fan-in Intro
Error Handling in Concurrent Go Programs
Unit 1: Error Handling Fundamentals
Why Error Handling?
Error Values in Go
Error Handling Strategies
Unit 2: Channels for Error Propagation
Error Channels
Sending Errors
Receiving Errors
Error Aggregation
Unit 3: Graceful Shutdown with Context
Context Package Intro
Context for Cancellation
Propagating Cancellation
Shutdown Signals
Combining Context & Channels
Unit 4: Advanced Error Handling
Error Wrapping
Custom Error Types
Logging Errors
Building a Simple REST API with `net/http`
Unit 1: Introduction to `net/http`
Hello, HTTP!
Anatomy of a Request
Your First Handler
Path Party: URL Routing
Error Handling Basics
Unit 2: HTTP Methods and Request Handling
Method Mania: GET
Posting Data with POST
PUTting it All Together
Deleting with DELETE
Status Code Secrets
Unit 3: Advanced Server Configuration
Server Configuration
Shutdown Gracefully
Middleware Magic
HTTPS, Secured!
Customizing Headers
Data Serialization and Deserialization (JSON)
Unit 1: JSON Fundamentals
What is JSON?
JSON Data Types
JSON Structure
Validating JSON
JSON vs. YAML
Unit 2: Serialization in Go
Serialization Intro
Basic Serialization
Struct Tags
Customizing Output
Gotchas in Serialization
Unit 3: Deserialization in Go
Deserialization Intro
Basic Deserialization
Handling Missing Fields
Dynamic Data
Deserialization Errors
Concurrency Patterns: Worker Pools
Unit 1: Understanding Worker Pools
What is a Worker Pool?
Worker Pool Benefits
Worker Pool Use Cases
Unit 2: Implementing a Worker Pool in Go
Setting up the Task
Creating the Worker
Task and Result Channels
Starting the Workers
Submitting Tasks
Unit 3: Collecting Results and Handling Errors
Collecting Results
Error Handling
Graceful Shutdown
Unit 4: Advanced Worker Pool Concepts
Dynamic Worker Scaling
Prioritized Tasks
Worker Pool Monitoring
Context-Aware Workers
Concurrency Patterns: Fan-Out/Fan-In
Unit 1: Understanding Fan-Out/Fan-In
Fan-Out/Fan-In Intro
Fan-Out Explained
Fan-In Explained
Fan-Out/Fan-In Diagram
Fan-Out/Fan-In Benefits
Unit 2: Implementing Fan-Out
Fan-Out: The Setup
Fan-Out: Worker Logic
Fan-Out: Error Handling
Fan-Out: Wait for Workers
Fan-Out: Best Practices
Unit 3: Implementing Fan-In
Fan-In: The Setup
Fan-In: Multiplexing
Fan-In: Error Handling
Fan-In: Handling Results
Fan-In: Best Practices
Managing Concurrent Access to Shared Resources: `sync` Package
Unit 1: Introduction to the `sync` Package
Sync Package Overview
Race Conditions Explained
Why Sync?
Unit 2: Mutexes: Protecting Shared Resources
Mutex Intro
Mutex Example
RWMutex Intro
RWMutex Example
Unit 3: WaitGroups: Synchronizing Goroutines
WaitGroup Intro
WaitGroup Example
WaitGroup Pitfalls
Unit 4: sync.Once: Initialization
Once Intro
Once Example
Once and Errors
Unit 5: Advanced Sync Concepts
Cond Intro
Cond Example
sync.Map Intro
API Middleware and Request Context
Unit 1: Introduction to API Middleware
What is Middleware?
Middleware Structure
Basic Logging Middleware
Registering Middleware
Chaining Middleware
Unit 2: Authentication Middleware
Auth Middleware Intro
API Key Authentication
JWT Authentication
Protecting API Endpoints
Unit 3: Request Context
Context Explained
Passing Values
Context in Goroutines
Request Cancellation
Context Best Practices
Testing and Benchmarking Concurrent APIs
Unit 1: Unit Testing API Handlers
Intro to Unit Testing
Writing Your First Test
Table-Driven Tests
Mocking Dependencies
Testing Error Cases
Unit 2: Integration Testing API Endpoints
Intro to Integration Tests
Testing API Endpoints
Database Interactions
Auth and Middleware Tests
Test Data Setup
Unit 3: Benchmarking and Performance Analysis
Intro to Benchmarking
Benchmarking Tools
Concurrent Benchmarks
Load Testing
Optimization Strategies