Simple Go Lang web service to send emails 🧸✉️
moved to https://www.camelcodes.net/simple-go-rest-web-service-to-send-smtp-emails/
Table of contents
In this article, we'll be creating a simple Go application that acts as a REST service.
The application will have one end-point /api/contact
will run on port 8080
, and will be installed as a systemd
service on Ubuntu 20.
Let's start.
What is Go 🧸 ?
Go is a simple and efficient programming language created by Google. It is known for its clean syntax, strong concurrency support, and excellent performance.
Learn more about Go: https://go.dev
Preparing the Go environment
I'm using Ubuntu 20 for this tutorial, If you need to install go on another platform you can refer to the official documentation: https://go.dev/dl/
On Ubuntu installing Go is as simple as running
apt update && apt install golang
and then adding the go binaries to the system path by updating my ~/.bashrc
with these two lines.
export GOPATH=$HOME/go
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
To explain, the lines added above are shell commands commonly used in Go development environments to set up the necessary environment variables.
Read the full article here : https://www.camelcodes.net/simple-go-rest-web-service-to-send-smtp-emails/