Skip to content

Commit a66bf33

Browse files
committed
initial go-http server and deploy
1 parent a8857ee commit a66bf33

File tree

5 files changed

+92
-71
lines changed

5 files changed

+92
-71
lines changed

.gitignore

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Binaries
2+
*.exe
3+
*.dll
4+
*.so
5+
*.dylib
6+
7+
# Build outputs
8+
bin/
9+
build/
10+
dist/
11+
12+
# Compiled object files
13+
*.o
14+
*.a
15+
16+
# Test binaries
17+
*.test
18+
19+
# Logs
20+
*.log
21+
logs/
22+
log/
23+
24+
# Coverage reports
25+
coverage.out
26+
coverage/
27+
28+
# Temporary files
29+
tmp/
30+
temp/
31+
*.tmp
32+
33+
# Vendor directory (if not committing vendor dependencies)
34+
vendor/
35+
36+
# IDE/editor configurations
37+
.vscode/
38+
.idea/
39+
*.sublime-project
40+
*.sublime-workspace
41+
42+
# OS-specific files
43+
.DS_Store
44+
Thumbs.db
45+
46+
# Other
47+
*.bak
48+
*.old

README.md

Lines changed: 4 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,18 @@
1-
# A CHANGEME-FRAMEWORK App Running On AWS Lambda
1+
# A Go HTTP App Running On AWS Lambda
22

3-
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/scaffoldly/scaffoldly-examples/scaffoldly.yml?branch=CHANGEME-BRANCHNAME&link=https%3A%2F%2Fgithub.com%2Fscaffoldly%2Fscaffoldly-examples%2Factions)
3+
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/scaffoldly/scaffoldly-examples/scaffoldly.yml?branch=go-http&link=https%3A%2F%2Fgithub.com%2Fscaffoldly%2Fscaffoldly-examples%2Factions)
44

55
## ✨ Quickstart
66

77
Run the following command to create your own copy of this application:
88

99
```bash
10-
npx scaffoldly create app --template CHANGEME-BRANCHNAME
10+
npx scaffoldly create app --template go-http
1111
```
1212

13-
## Manual Setup
14-
15-
This application was generated with the following command:
16-
17-
```bash
18-
CHANGEME-CREATECOMMAND
19-
```
20-
21-
✨ No modifications or SDKs were made or added to the code to "make it work" in AWS Lambda.
22-
23-
Check out our other [examples](https://github.com/scaffoldly/scaffoldly-examples) and Learn more at [scaffoldly.dev](https://scaffoldly.dev)!
24-
2513
### Working example
2614

27-
[CHANGEME-URL](CHANGEME-URL)
28-
29-
## First, Scaffoldly Config was added...
30-
31-
In the project's [`CHANGEME-CONFIGFILE`](CHANGEME-CONFIGFILE) file, the `scaffoldly` configuration was added:
32-
33-
- Note 1
34-
- Note 2
35-
36-
```
37-
CHANGEME-CONFIG
38-
```
39-
40-
See the [Scaffoldly Docs](https://scaffoldly.dev/docs/config/) for additional configuration directives.
41-
42-
## Then, deployed to AWS Lambda
43-
44-
```bash
45-
npx scaffoldly deploy
46-
```
47-
48-
See the [Scaffoldly Docs](https://scaffoldly.dev/docs/cli/#scaffoldly-deploy) for details on the `scaffoldly deploy` command.
49-
50-
### After deploy the app is available on a public URL
51-
52-
```bash
53-
🚀 Deployment Complete!
54-
🆔 App Identity: CHANGEME-IDENTITY
55-
📄 Env Files: .env.main, .env
56-
📦 Image Size: CHANGEME-IMAGESIZE MB
57-
🌎 URL: CHANGEME-URL
58-
```
59-
60-
## GitHub Action added for CI/CD
61-
62-
A [`scaffoldly.yml`](.github/workflows/scaffoldly.yml) was added to `.github/workflows` so that a push will trigger a deploy
63-
64-
```
65-
name: Scaffoldly Deploy
66-
67-
# ... snip ...
68-
69-
jobs:
70-
deploy:
71-
runs-on: ubuntu-latest
72-
steps:
73-
- name: Checkout
74-
uses: actions/checkout@v4
75-
76-
- name: Deploy
77-
uses: scaffoldly/scaffoldly@v1
78-
with:
79-
secrets: ${{ toJSON(secrets) }}
80-
```
81-
82-
See the [Scaffoldly Docs](https://scaffoldly.dev/docs/gha/) for additional GitHub Actions directives.
15+
[https://j3q6q4j5gk3hgcwsyyz7o32tvu0cwamm.lambda-url.us-east-1.on.aws](https://j3q6q4j5gk3hgcwsyyz7o32tvu0cwamm.lambda-url.us-east-1.on.aws)
8316

8417
## Questions, Feedback, and Help
8518

cmd/server/main.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"net/http"
6+
)
7+
8+
func main() {
9+
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
10+
fmt.Fprintln(w, "Hello, World!")
11+
})
12+
13+
fmt.Println("Starting server on :8080...")
14+
err := http.ListenAndServe(":8080", nil)
15+
if err != nil {
16+
fmt.Println("Error starting server:", err)
17+
}
18+
}

go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module go-http
2+
3+
go 1.22.4

scaffoldly.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"runtime": "alpine:3.20",
3+
"handler": "localhost:8080",
4+
"bin": {
5+
"server": "connect:bin/server"
6+
},
7+
"services": [
8+
{
9+
"name": "server",
10+
"runtime": "golang:1.23-alpine3.20",
11+
"files": ["bin"],
12+
"scripts": {
13+
"install": "go mod tidy",
14+
"build": "go build -o bin/ ./cmd/server",
15+
"start": "server"
16+
}
17+
}
18+
]
19+
}

0 commit comments

Comments
 (0)