Creating a basic Go HTTP server
In this demonstration, we will be creating a very basic Golang HTTP server. If you already have a Golang application, simply head to the “Going live with Nubo” section below.Setting up the project
Let’s first get our workspace configured. We will create a new folder and initialize a new go module.go mod init
command we should a new go.mod
file. This file will look like:
go.mod
main.go
file which will store the logic for our server.
Writing the server (main.go
)
First we need to initialize our package and define our imports.
main.go
main.go
8080
. If the server fails to start our app will panic.
We will now need to define the logic for the ”/” endpoint. We will do this by creating our rootHandleFunc
function.
main.go
GET
method is accepted. We are then sending a simple plaintext message back to the user.
Running the server
We are now ready to test our server! Head to a terminal and run the following:localhost:8080
you should receive our message back from the server!
Full main.go
file
main.go
Git operations
To update our repository we can commit our changes and push to our remote repository.Going live with Nubo
Golang is support with Nubo out of the box, with no configuration necessarily required.1
Open the new Frame modal
Click on the ”+ Frame” butotn

2
Choose repository and configure port
Select your repository from the list of repos that are displayed. Then, if applicable, configure your port to match the port that your server is listening on.

Setting a custom Go version
By default, Nubo will determine the version of Golang to use based on yourgo.mod
file. But, in the event that you need to manually specify the version. Create project.toml
file like below: