angular2를 이용했을 경우 웹소스를 하나로 묶어 bindata.go 바이너리 파일을 만들고,
서버소스.go + bindata.go 묶어 binary 파일이 생성된다.

1. Installation
To install the library and command line program, use the following:
go get -u github.com/jteeuwen/go-bindata/...
##또는
go install vendor/github.com/jteeuwen/go-bindata/go-bindata
##src/vendor/github.com/jteeuwen/go-bindata 확인

2. Path prefix stripping
The keys used in the _bindata map, are the same as the input file name passed to go-bindata. This includes the path. In most cases, this is not desireable, as it puts potentially sensitive information in your code base. For this purpose, the tool supplies another command line flag -prefix. This accepts a portion of a path name, which should be stripped off from the map keys and function names.
For example, running without the -prefix flag, we get:
$ go-bindata -pkg studio -prefix "web/dist/" web/dist/...
$ go fmt bindata.go
Makefile에 넣을 경우
PUBLIC_FILES = $(shell find dist/ -type f)
.PHONY: all clean
all: microservice
clean:
rm -rf web/dist/*
bindata:
go-bindata -pkg studio -prefix "web/dist/" web/dist/...
go fmt bindata.go
build:
cd web && npm install && ng build -prod
microservice: clean build bindata
$cd src/... ##Make파일이 존재하는 위치
$make
-
Go : http 서버(go 자체 http 서버가 있다) -> 8080
-
Angular : Angualr 웹 서버(ng 서버) -> 4200,
Angular 웹 서버가 go서버와 통신하려면 property 파일에 go 서버 정보가 있어야 한다
-
ng compile (javascript trans compile) web pack(javascript(mini file))
-
ng build –-prod web/src/environments/ 디렉토리 밑에 local 및 운영 서버 파일 생성
-
web에서 소스를 바꼈을 경우 최종으로 make를 돌려야 bindata.go가 적용이 된다.
-
go 서버에서 소스를 바뀌었을 경우 make를 안 돌려도 된다.
'프로젝트 > go' 카테고리의 다른 글
Go 언어 입문_Method(메소드) (0) | 2019.09.09 |
---|---|
Go 언어 입문_Struct(구조체)* (0) | 2019.09.06 |
Go 언어 입문_함수* (0) | 2019.09.06 |
Go 언어 입문_변수 (0) | 2019.09.02 |
Go 언어 입문 (1) | 2019.09.02 |