Updated README.md for 0.5.4 (#251)
Instructions here didn't work with latest pull (0.5.4).
This commit is contained in:
24
examples/functions/Golang/README.md
vendored
24
examples/functions/Golang/README.md
vendored
@@ -1,4 +1,5 @@
|
||||
# Make a Golang function a service with fx
|
||||
(v0.5.4 or newer)
|
||||
|
||||
Write a function like,
|
||||
|
||||
@@ -14,24 +15,31 @@ func fx(ctx *gin.Context) {
|
||||
}
|
||||
```
|
||||
|
||||
into a file named ```fx_hello.go```
|
||||
|
||||
then deploy it with `fx up` command,
|
||||
|
||||
```shell
|
||||
$ fx up -p 8080:3000 func.go
|
||||
$ fx up -name fx_hello -p 10001 --healthcheck fx_hello.go
|
||||
2019/08/30 10:12:11 info Build Service fx_hello: ✓
|
||||
2019/08/30 10:12:11 info Run Service: ✓
|
||||
2019/08/30 10:12:11 info Service (fx_hello) is running on: 0.0.0.0:10001
|
||||
2019/08/30 10:12:11 info service is running
|
||||
2019/08/30 10:12:12 info service is running
|
||||
2019/08/30 10:12:13 info service is running
|
||||
2019/08/30 10:12:14 info up function fx_hello(fx_hello.go) to machine localhost: ✓
|
||||
```
|
||||
|
||||
test it using `curl`
|
||||
|
||||
```shell
|
||||
$ curl 127.0.0.1:8080
|
||||
|
||||
$ curl -i 127.0.0.1:10001
|
||||
HTTP/1.1 200 OK
|
||||
Connection: keep-alive
|
||||
Content-Length: 11
|
||||
Content-Type: text/plain; charset=utf-8
|
||||
Date: Tue, 06 Aug 2019 15:58:41 GMT
|
||||
Content-Type: application/json; charset=utf-8
|
||||
Date: Fri, 30 Aug 2019 17:12:33 GMT
|
||||
Content-Length: 25
|
||||
|
||||
hello world
|
||||
{"message":"hello world"}
|
||||
```
|
||||
|
||||
### ctx
|
||||
|
||||
Reference in New Issue
Block a user