File tree Expand file tree Collapse file tree 4 files changed +15
-9
lines changed
examples/http-tinygo-outbound-http Expand file tree Collapse file tree 4 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -132,7 +132,7 @@ allowed_http_hosts = [ "some-random-api.ml" ]
132
132
route = " /hello"
133
133
```
134
134
135
- > Spin HTTP components written in Go must currently use the Wagi executor.
135
+ > Spin HTTP components written in Go use the Spin executor.
136
136
137
137
Running the application using ` spin up --file spin.toml ` will start the HTTP
138
138
listener locally (by default on ` localhost:3000 ` ), and our component can
Original file line number Diff line number Diff line change @@ -214,7 +214,7 @@ print("content-type: text/html; charset=UTF-8\n\n");
214
214
print("hello world\n");
215
215
```
216
216
217
- The [ Go SDK for Spin] ( ./go-components.md ) is built on the Wagi executor support .
217
+ The [ Go SDK for Spin] ( ./go-components.md ) supports the Spin executor.
218
218
Here is another example, written in [ Grain] ( https://grain-lang.org/ ) ,
219
219
a new programming language that natively targets WebAssembly:
220
220
Original file line number Diff line number Diff line change @@ -42,7 +42,6 @@ source = "main.wasm"
42
42
allowed_http_hosts = [ " https://some-random-api.ml" , " https://postman-echo.com" ]
43
43
[component .trigger ]
44
44
route = " /hello"
45
- executor = { type = " wagi" }
46
45
```
47
46
48
47
At this point, we can execute the application with the ` spin ` CLI:
Original file line number Diff line number Diff line change 1
1
# The (Tiny)Go SDK for Spin
2
2
3
3
This package contains an SDK that facilitates building Spin components in
4
- (Tiny)Go. It currently allows building HTTP components that target the Wagi
4
+ (Tiny)Go. It allows building HTTP components that target the Spin
5
5
executor.
6
6
7
7
``` go
8
- func main () {
9
- // call the HandleRequest function
10
- spin_http.HandleRequest (func (w http.ResponseWriter , r *http.Request ) {
11
- fmt.Fprintln (w, " Hello, Fermyon!" )
12
- })
8
+ import (
9
+ " fmt"
10
+ spinhttp " github.com/fermyon/spin/sdk/go/http"
11
+ )
12
+
13
+ func init () {
14
+ // call the Handle function
15
+ spinhttp.Handle (func (w http.ResponseWriter , r *http.Request ) {
16
+ fmt.Fprintln (w, " Hello, Fermyon!" )
17
+ })
13
18
}
19
+
20
+ func main () {}
14
21
```
You can’t perform that action at this time.
0 commit comments