Practical Go Services

ArdanLabs ∴ 2022

Miki Tebeka miki@353solutions.com, @tebeka, mikitebeka, blog

Shameless Plugs


Day 4

Agenda

  • Security best practices
  • OWASP top 10
  • The security mindset

Terminal Log

Links

Data & Other

  • curl -d@./_class/start.json http://localhost:8080/rides
  • curl -uBond:007 -d@./_class/start.json http://localhost:8080/rides

Day 3

Agenda

  • Testing overview
  • Testing handlers
  • Running services in testing
  • Mocking
  • Performance optimization

Terminal Log

Links

Data & Other

  • go get github.com/rakyll/hey@latest

Day 2

Agenda

  • Databases
  • Working with database/sql
  • Working with redis
  • Logging
  • Monitoring

Terminal Log

Links

Data & Other

  • docker exec -it <id> psql -U postgres
    • or pgcli -p 5432 -U postgres -h localhost
  • docker exec -it <id> redis-cli

Day 1

Agenda

  • REST APIs
  • Handlers
  • JSON
  • Middleware

Code

Clone the repo:

$ git clone https://github.com/353solutions/srv-2210.git unter

Terminal Log

Links

Design

[library]
layers:
    - business
    - foundations

front ends: [web] [cli] [gui]

Rules of thumb: imports go downward in the layers

Data Types: one per layer API Business Database

Data & Other

  • curl -d'{"driver": "gomez", "kind": "private"}' http://localhost:8080/rides
  • curl -d'{"distance": 3.14}' http://localhost:8080/rides/<id>/end