Go Beyond JavaScript

Build Fast, Reliable Backends with Golang

Discovery Week – MicroClub

Who Am I?

  • SWE student & Backend Developer
  • Today: Show you why Go is amazing for backends

Why Golang?

  • Simple, readable syntax - easy to learn
  • Lightning fast - compiles to machine code
  • Built-in tools - formatter, linter, tests
  • Great concurrency - goroutines are magical
  • Industry proven - used by major companies

Who Uses Go?

Google
Uber
Docker
Netflix
Dropbox
Kubernetes

Go powers some of the biggest systems on the internet!

Go vs Express (Node.js)

Express.js
const express = require('express');
const app = express();

app.get('/', (req, res) => {
  res.send('Hello World!');
});

app.listen(3000);
Go + Chi
package main

import (
  "net/http"
  "github.com/go-chi/chi/v5"
)

func main() {
  r := chi.NewRouter()
  
  r.Get("/", func(w http.ResponseWriter, r *http.Request) {
    w.Write([]byte("Hello World!"))
  })
  
  http.ListenAndServe(":3000", r)
}

What We'll Build

Mini Blog API

GET /posts

POST /posts

GET /posts/{id}

DELETE /posts/{id}

Storage: In-memory

Key Concepts

  • Structs - Go's way to organize data
  • JSON encoding/decoding - API communication
  • HTTP routing with Chi - clean URL handling
  • Middleware - add functionality to requests
  • Error handling - Go's explicit approach

Our Data Structure

// Post represents a blog post
type Post struct {
    ID      int    `json:"id"`
    Title   string `json:"title"`
    Content string `json:"content"`
    Author  string `json:"author"`
}

// In-memory storage
var posts []Post
var nextID = 1

Sample Handler

func getPosts(w http.ResponseWriter, r *http.Request) {
    // Set content type
    w.Header().Set("Content-Type", "application/json")
    
    // Encode posts to JSON and send response
    if err := json.NewEncoder(w).Encode(posts); err != nil {
        http.Error(w, "Error encoding posts", http.StatusInternalServerError)
        return
    }
}

Why You'll Love Go

  • Fast builds & runtime - no waiting around
  • Readable codebase - easy to maintain
  • Perfect for APIs - microservices, CLIs
  • Great job market - high demand, good salaries
  • Amazing community - helpful and welcoming

What's Next?

Resources to Continue Learning:

Challenge: Build a small project in Go this week!

Questions & Answers

Let's discuss Go and answer your questions!

Workshop materials: Available on GitHub

Stay connected: Join our community discussions