replace initialization command of templates to gonew

This commit is contained in:
syumai 2023-09-09 22:17:13 +09:00
parent 8546b90d48
commit 146ccd1d7e
4 changed files with 33 additions and 7 deletions

View File

@ -16,10 +16,18 @@
## Getting Started
* If not already installed, please install the [gonew](https://pkg.go.dev/golang.org/x/tools/cmd/gonew) command.
```console
wrangler generate my-app syumai/workers/_templates/cloudflare/pages-tinygo
go install golang.org/x/tools/cmd/gonew@latest
```
* Create a new project using this template.
- Second argument passed to `gonew` is a module path of your new app.
```console
gonew github.com/syumai/workers/_templates/cloudflare/pages-tinygo your.module/my-app # e.g. github.com/syumai/my-app
cd my-app
go mod init
go mod tidy
make dev # start running dev server
curl http://localhost:8787/api/hello # outputs "Hello, Pages Functions!"

View File

@ -1,4 +1,4 @@
module github.com/syumai/workers/_examples/pages-functions
module github.com/syumai/workers/_examples/pages-tinygo
go 1.18

View File

@ -21,10 +21,20 @@
## Getting Started
## Getting Started
* If not already installed, please install the [gonew](https://pkg.go.dev/golang.org/x/tools/cmd/gonew) command.
```console
wrangler generate my-app syumai/workers/_templates/cloudflare/worker-go
go install golang.org/x/tools/cmd/gonew@latest
```
* Create a new project using this template.
- Second argument passed to `gonew` is a module path of your new app.
```console
gonew github.com/syumai/workers/_templates/cloudflare/worker-go your.module/my-app # e.g. github.com/syumai/my-app
cd my-app
go mod init
go mod tidy
make dev # start running dev server
curl http://localhost:8787/hello # outputs "Hello!"

View File

@ -16,10 +16,18 @@
## Getting Started
* If not already installed, please install the [gonew](https://pkg.go.dev/golang.org/x/tools/cmd/gonew) command.
```console
wrangler generate my-app syumai/workers/_templates/cloudflare/worker-tinygo
go install golang.org/x/tools/cmd/gonew@latest
```
* Create a new project using this template.
- Second argument passed to `gonew` is a module path of your new app.
```console
gonew github.com/syumai/workers/_templates/cloudflare/worker-tinygo your.module/my-app # e.g. github.com/syumai/my-app
cd my-app
go mod init
go mod tidy
make dev # start running dev server
curl http://localhost:8787/hello # outputs "Hello!"