i try to build a simple golang backend and its work normaly on my computer. but when i try to deploy its not working.
code is this
package main
import (
"log"
"net/http"
)
type Application struct {
Domain string
port string
}
func main() {
var app Application
app.port = ":8080"
log.Println("Starting in port " + app.port)
err := http.ListenAndServe(app.port, app.routes())
if err != nil {
log.Fatal(err.Error())
}
}
i use makefile to build and run
.PHONY: build run test
build:
@go build -o ./bin/Test ./cmd/api
run: build
@./bin/Test
test:
@go test -v ./cmd/test
thank you for helping
How to deploy golang backend to web server. can i use just
go build
or i need to use any tool for this. I’m very newbie in this. i ask the assistant and its seem like can use like this but i cant. please help!
New contributor
Rulic lll is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.