Go
Go Net Listener Http Server Example
We explore the net package, spin up a net.Listener, accept requests, and respond with html
Using Go Embed Package for Template Rendering
Go’s embed package is excellent for creating a Go template rendering engine. The benefit of using the embed package is that your templates get bundled with your binary. Learn how to use the embed package to render templates in golang applications.
Notes On Testing Golang Applications
Setup Main
setup_test.go
is where you do any app setup for your test. This runs
before the rest of the tests and can help you mock things that need to be
mocked. When you build your application, test files are ignored. It is a
safe space to declare variables, override variables, etc. Each package can
have a TestMain func in the setup_test.go file.
// setup_test.go in the main package
package main
// may need to declare some testing specific vars up here
var mock *config.AppConfig
var mockDB *sqlDB
func TestMain(m *testing.M) {
// configure your testing specific app config mocks
mockApp.Title = ""
mockApp.DSN = ""
// mock session, repos, pass around any extra config to internal
packages
newSessionManager(mockApp, mockDB)
handlers.SetHandlerRepo(handlers.NewHandlerRepo(mockApp, sqldbconn.NewSQLDbConn(mockApp, mockDB)))
render.NewRenderer(mockApp)
// the rest of the config setup that runs before test
// init TestMain
os.Exit(m.Run())
}
Adding Context And Session To http.Request
Create a couple of helper functions to create dummy session data and add it to the request:
Custom Golang Http Router With Middleware
Go standard library, as well as many others have already solved implementing a robust, production grade http server. So why bother writing one? This post will hopefully yield some insight of why it is important to revisit established technology.
Neovim Custom File Extension Syntax Highlighting
We learn how to use treesitter injections to setup syntax highlighting for custom file extensions
Golang Send Multipart Form Data to Api Endpoint
We often need to send data and files from one JSON API endpoint to another. In this post, I explain how to use multipartform writer to send form data across api endpoint boundaries.
Unit Testing Json Encode
Here are my notes on testing a JSON writer for Golang that lets you wrap the response in an envelope
Go Channels Tutorial - Understanding Goroutines and Channels
Go has powerful concurrency tools fully baked into the programming Language. This post aims to explain go routines and channels so you can get started using them in your own projects.
Golang Image Resize and Golang Image Crop: Image Manipulation With Go Programming Language
An introduction to some of the very basic features of iamge cropping with Go.
Golang Read Environment Variables From File: How To Do It [Code Snippets]
What Are Environmental Variables In Go
A Cautionary Tale: My AWS Account Was Hacked And I Have A $50,000 Bill
If you have ever used an API key or database connection string, you have most likely had a need to secure some sensitive data. Environment variables are a way to achieve this. We may need to do this because certain API’s can only be called so many times and the key is a way of authorizing our requests and keeping track of them. For example, the twitter API only allows 500k Tweets per monthcalls on the free Essential Access account per application. -Source: Twitter Developer Documentation
Categories
Analytics
Go
Linux
Personal Coaching Tips
Search Engine Optimization
SEO
Web Design
Web Development
- Docker: Important Topics & Notes
- Go Net Listener Http Server Example
- Using Go Embed Package for Template Rendering
- Notes On Testing Golang Applications
- Custom Golang Http Router With Middleware
- WordPress Self Hosted A Guided Tour To Running Wordpress Independent Of Big Hosting
- Neovim Custom File Extension Syntax Highlighting
- Importing Content From Hugo Into Wordpress
- Why I Dont Recommend Getflywheel or Wpengine for Most Wordpress Hosting
- Javascript Count Up to Number
- Golang Send Multipart Form Data to Api Endpoint
- Create an Accessible Vanilla Javascript Accordion
- Golang Create a Random String
- Go Channels Tutorial - Understanding Goroutines and Channels
- Call, Apply, And Bind Methods In Javascript
- Vanilla Javascript Carousel Slider: A Beginner's Tutorial
- Golang Image Resize and Golang Image Crop: Image Manipulation With Go Programming Language
- How To Create A Website For Your Online Business: Small Business Website Guide
- Frontmatter Data And Hugo Templates: How To Output Data With Hugo Static Site Generator
- Golang Read Environment Variables From File: How To Do It [Code Snippets]
- How To Create A Template Cache For Your Golang Web Application
- Bootstrap A New Hugo Theme From Scratch [video]
- Install Hugo With Chocolatey Package Manager On Windows 10 [video]
- Web Hosting Free Sites: Web Hosting For Developers
- CSS Grid Gallery: Easy Fluid Gallery With CSS Grid and Javascript
- Custom React Hook Function: Create Custom Reusable React Hooks
- React State Array: Updating An Array That Is Stored Inside Of State
- 5 Things You Need To Know Before And After You Build A Website
- 5 Trends For Traverse City Web Development In 2022
Web Devsign
Tags
.Env
A11ty
Accessibility
API Development
Apply
Bind
Blockchain
Business
Call
Call to Actions
Certbot
Channels
CMS
Concurrency
Content Marketing
Cookieless Analytics
Crypto
Css
Data
Data Migration
DevOps
Digital Marketing
Displaylink
Docker
Dotenv
Educational
Ethereum
Fail2ban
FOSS
Frontend
Frontend Web Development
Frontmatter
Go
- Go Net Listener Http Server Example
- Using Go Embed Package for Template Rendering
- Notes On Testing Golang Applications
- Custom Golang Http Router With Middleware
- Neovim Custom File Extension Syntax Highlighting
- Golang Send Multipart Form Data to Api Endpoint
- Unit Testing Json Encode
- Go Channels Tutorial - Understanding Goroutines and Channels
- Golang Image Resize and Golang Image Crop: Image Manipulation With Go Programming Language
- Golang Read Environment Variables From File: How To Do It [Code Snippets]
Go Application Configuration
Golang
- Go Net Listener Http Server Example
- Using Go Embed Package for Template Rendering
- Notes On Testing Golang Applications
- Custom Golang Http Router With Middleware
- Golang Send Multipart Form Data to Api Endpoint
- Unit Testing Json Encode
- Golang Create a Random String
- Go Channels Tutorial - Understanding Goroutines and Channels
- Golang Image Resize and Golang Image Crop: Image Manipulation With Go Programming Language
- Golang Read Environment Variables From File: How To Do It [Code Snippets]
- How To Create A Template Cache For Your Golang Web Application
- Bootstrap A New Hugo Theme From Scratch [video]
- Install Hugo With Chocolatey Package Manager On Windows 10 [video]
Google Analytics
Google Analytics 4
Google Analytics Alterantives
Google Business Profile Optimization
Growth Tips
Hosting
Html
HTTP
Hugo
Image Processing
JAMStack
Javascript
- Javascript Count Up to Number
- Create an Accessible Vanilla Javascript Accordion
- Call, Apply, And Bind Methods In Javascript
- Vanilla Javascript Carousel Slider: A Beginner's Tutorial
- Javascript For Countdown Timer | [VIDEO]
- What Is Blockchain Technology And How Does It Work?
- Hugo Website Tutorial: How To Create A Hugo Website
- CSS Grid Gallery: Easy Fluid Gallery With CSS Grid and Javascript
- Custom React Hook Function: Create Custom Reusable React Hooks
- React State Array: Updating An Array That Is Stored Inside Of State
- Everything You Need To Know About Parallax Scrolling & Javascript
JSON
Local Citations
Local SEO
Manjaro
Mariabdb
Mime-Type Detection
Multipart Forms
Neovim
Nginx
Open Source
Php
Planning
Privacy First Analytics
Privacy Oriented
React
Rune
SCM Injections
SCSS
Scss Cheatsheet
Search Engine Optimization
Security
Self Hosting
SEO
SEO Traverse City
Server
Server Programming
Server Side Go
Small Business SEO
Smart Contracts
Social Media Marketing
Solidity
Ssh
Static Site Generator
Static Website Generators
Static Websites
TCP
TDD
Test Driven Development
Testing
Tools
Traverse City
Traverse City Business
Traverse City Web Design
Treesitter
Trends
UFW
UI
Unit Testing
Universal Analytics
Vanilla Javascript
VPS
Web 3.0
Web Analytics
Web Design
Web Design Traverse City
Web Development
- Golang Image Resize and Golang Image Crop: Image Manipulation With Go Programming Language
- How To Create A Template Cache For Your Golang Web Application
- Javascript For Countdown Timer | [VIDEO]
- Web Hosting Free Sites: Web Hosting For Developers
- CSS Grid Gallery: Easy Fluid Gallery With CSS Grid and Javascript
- Custom React Hook Function: Create Custom Reusable React Hooks
- React State Array: Updating An Array That Is Stored Inside Of State
- 5 Things You Need To Know Before And After You Build A Website
- Everything You Need To Know About Parallax Scrolling & Javascript
- Everything You Need To Know About Content Delivery Networks As A Beginner
- 10 Static Site Mistakes You Should Stop Making: A blog about the common mistakes people make when creating static sites.
Web Development Tips
Web Hosting
Website Builder
Website Conversion
Website Design
WordPress