Skip to content

Commit

Permalink
Merge pull request #15 from cxjava/gonew
Browse files Browse the repository at this point in the history
Use gonew to create new project base on template
  • Loading branch information
donseba committed Jul 30, 2024
2 parents 07834da + 7acac95 commit 6c32986
Show file tree
Hide file tree
Showing 10 changed files with 155 additions and 1 deletion.
17 changes: 17 additions & 0 deletions examples/pokedex/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/
vendor/
.idea/
30 changes: 30 additions & 0 deletions examples/pokedex/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

## Getting Started

* If not already installed, please install the [gonew](https://pkg.go.dev/golang.org/x/tools/cmd/gonew) command.

```console
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/donseba/go-htmx/examples/pokedex your.module/my-app # e.g. github.com/donseba/my-app
cd my-app
go mod tidy
go build

```

## Testing

- Start your app

```console
./my-app
```

- Open your browser http://localhost:3210/
- Search `charizard` or `metapod`
5 changes: 5 additions & 0 deletions examples/pokedex/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/donseba/go-htmx/examples/pokedex

go 1.22

require github.com/donseba/go-htmx v1.9.0
17 changes: 17 additions & 0 deletions examples/render/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/
vendor/
.idea/
29 changes: 29 additions & 0 deletions examples/render/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

## Getting Started

* If not already installed, please install the [gonew](https://pkg.go.dev/golang.org/x/tools/cmd/gonew) command.

```console
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/donseba/go-htmx/examples/render your.module/my-app # e.g. github.com/donseba/my-app
cd my-app
go mod tidy
go build

```

## Testing

- Start your app

```console
./my-app
```

- Open your browser http://localhost:3210/
5 changes: 5 additions & 0 deletions examples/render/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/donseba/go-htmx/examples/render

go 1.22

require github.com/donseba/go-htmx v1.9.0
17 changes: 17 additions & 0 deletions examples/sse/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/
vendor/
.idea/
29 changes: 29 additions & 0 deletions examples/sse/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

## Getting Started

* If not already installed, please install the [gonew](https://pkg.go.dev/golang.org/x/tools/cmd/gonew) command.

```console
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/donseba/go-htmx/examples/sse your.module/my-app # e.g. github.com/donseba/my-app
cd my-app
go mod tidy
go build

```

## Testing

- Start your app

```console
./my-app
```

- Open your browser http://localhost:3210/
5 changes: 5 additions & 0 deletions examples/sse/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/donseba/go-htmx/examples/sse

go 1.22

require github.com/donseba/go-htmx v1.9.0
2 changes: 1 addition & 1 deletion examples/sse/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<title>Server Sent Time Example</title>
<!-- Include HTMX -->
<script src="https://unpkg.com/htmx.org"></script>
<script src="https://unpkg.com/htmx.org/dist/ext/sse.js"></script>
<script src="https://unpkg.com/htmx-ext-sse@2.2.1/sse.js"></script>
</head>
<body>
<div hx-ext="sse" sse-connect="/sse" >
Expand Down

0 comments on commit 6c32986

Please sign in to comment.