jiji jiji - 1 year ago 305
TypeScript Question

Load Angular2 Bootstrap template ng2-admin on Go server : download fail

I am new to this forum and a newbie in

My issue is that I would like to try out a template on a

So, I created a
file containing this
function :

func main() {
r := mux.NewRouter()
p := http.StripPrefix("/", http.FileServer(http.Dir("./src/")))
n := http.StripPrefix("/config", http.FileServer(http.Dir("./config/")))
fmt.Printf("Starting server on :33166 \n")
http.ListenAndServe(":33166", r)

and run
go run main.go
on the project directory, but its fails in this request


It might be very simple, but I couldnot figure it out. So, any idea to how I'm able run the project on server would be appreciated. Thanks.

Answer Source

According to the ng2-admin installation guidelines, if you want to use ng2-admin with another backend (golang in your case), you need a release build using the following command:

npm run prebuild:prod && npm run build:prod

From installation guidelines:

This will clear up your dist folder (where release files are located), generate release build (...). Now you can copy the sources from a dist folder and use it with any backend framework or simply put it under some web server.

EDIT: Thanks to @PatrickWalker for his comments.