Skip to content

Commit 782041f

Browse files
authored
Merge pull request #216 from AndyManastorm/dipper-upgrade-develop-demo
feat: upgrade springboot+express+flask+gin example.
2 parents 8fd86ea + a040db4 commit 782041f

File tree

89 files changed

+1951
-398
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+1951
-398
lines changed

web-framework/go/gin/publish.yaml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Type: Project
33
Name: start-gin-cap
44
Provider:
55
- 阿里云
6-
Version: 0.0.5
6+
Version: 0.1.2
77
Description: 本案例展示了如何将 Gin,Go 语言社区中倍受追捧的轻量级 Web 框架,迅速构建并部署至云原生应用开发平台(CAP)。Gin 凭借其高效的处理能力、极简设计及高度灵活性,赢得了众多 Go 开发者的芳心,成为快速开发高质量 Web 应用和服务的首选武器。
88
HomePage: https://github.com/devsapp/start-web-framework/tree/dipper/web-framework/go/gin
99
Organization: 阿里云函数计算(FC)
@@ -12,6 +12,7 @@ Tags:
1212
- Web框架
1313
- gin
1414
- Custom Runtime
15+
- Develop
1516
Category: Web框架
1617
Service:
1718
函数计算:
@@ -20,12 +21,16 @@ Service:
2021
日志服务:
2122
Authorities:
2223
- AliyunFCServerlessDevsRolePolicy
24+
对象存储:
25+
Authorities:
26+
- AliyunOSSFullAccess
2327
Parameters:
2428
type: object
2529
additionalProperties: false # 不允许增加其他属性
2630
required: # 必填项
2731
- region
2832
- functionName
33+
- roleArn
2934
properties:
3035
region:
3136
title: 地域
@@ -58,3 +63,17 @@ Parameters:
5863
default: gin-${default-suffix}
5964
pattern: "^[a-zA-Z_][a-zA-Z0-9-_]{0,127}$"
6065
description: 函数名称,只能包含字母、数字、下划线和中划线。不能以数字、中划线开头。长度在 1-128 之间
66+
roleArn:
67+
title: 服务角色ARN
68+
type: string
69+
default: "AliyunFCDefaultRole"
70+
pattern: "^acs:ram::[0-9]*:role/.*$"
71+
description: "函数计算访问其他云服务时使用的服务角色,需要填写具体的角色ARN,格式为acs:ram::$account-id>:role/$role-name。例如:acs:ram::14310000000:role/aliyunfcdefaultrole。
72+
\n如果您没有特殊要求,可以使用函数计算提供的默认的服务角色,即AliyunFCDefaultRole。如果您首次使用函数计算,可以访问 https://fcnext.console.aliyun.com 进行授权。
73+
\n详细文档参考 https://help.aliyun.com/document_detail/181589.html?spm=5176.fcnext.help.dexternal.7bea78c8sVHoRf#section-o93-dbr-z6o"
74+
x-role:
75+
name: AliyunFCDefaultRole
76+
service: fc
77+
authorities:
78+
- AliyunOSSFullAccess
79+
- AliyunFCDefaultRolePolicy

web-framework/go/gin/readme.md

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55

66
<description>
77

8-
本案例展示了如何将 Gin —— Go 语言社区中倍受追捧的轻量级 Web 框架,迅速构建并部署至云原生应用开发平台(CAP)。Gin 凭借其高效的处理能力、极简设计及高度灵活性,赢得了众多 Go 开发者的芳心,成为快速开发高质量 Web 应用和服务的首选武器。
8+
本案例展示了如何将 GinGo 语言社区中倍受追捧的轻量级 Web 框架,迅速构建并部署至云原生应用开发平台(CAP)。Gin 凭借其高效的处理能力、极简设计及高度灵活性,赢得了众多 Go 开发者的芳心,成为快速开发高质量 Web 应用和服务的首选武器。
99

1010
</description>
1111

1212

13-
## 前期准备
13+
## 资源准备
1414

1515
使用该项目,您需要有开通以下服务并拥有对应权限:
1616

@@ -22,6 +22,7 @@
2222
| --- | --- | --- |
2323
| 函数计算 | AliyunFCFullAccess | [帮助文档](https://help.aliyun.com/product/2508973.html) [计费文档](https://help.aliyun.com/document_detail/2512928.html) |
2424
| 日志服务 | AliyunFCServerlessDevsRolePolicy | [帮助文档](https://help.aliyun.com/zh/sls) [计费文档](https://help.aliyun.com/zh/sls/product-overview/billing) |
25+
| 对象存储服务 | AliyunOSSFullAccess | [帮助文档](undefined) [计费文档](undefined) |
2526

2627
</service>
2728

@@ -41,7 +42,7 @@
4142

4243
<appcenter>
4344

44-
- :fire: 通过 [云原生应用开发平台 CAP](https://devs.console.aliyun.com/applications/create?template=start-gin-cap)[![Deploy with Severless Devs](https://img.alicdn.com/imgextra/i1/O1CN01w5RFbX1v45s8TIXPz_!!6000000006118-55-tps-95-28.svg)](https://devs.console.aliyun.com/applications/create?template=start-gin-cap) 该应用。
45+
- :fire: 通过 [云原生应用开发平台 CAP](https://cap.console.aliyun.com/template-detail?template=start-gin-cap)[![Deploy with Severless Devs](https://img.alicdn.com/imgextra/i1/O1CN01w5RFbX1v45s8TIXPz_!!6000000006118-55-tps-95-28.svg)](https://cap.console.aliyun.com/template-detail?template=start-gin-cap) 该应用。
4546

4647
</appcenter>
4748
<deploy>
@@ -53,7 +54,7 @@
5354

5455
<appdetail id="flushContent">
5556

56-
本案例是将 Gin ,这一非常受欢迎的 web 框架,快速创建并部署到云原生应用开发平台 CAP 。
57+
本案例是将 Gin ,这一非常受欢迎的 web 框架,快速创建并部署到云原生应用开发平台 CAP ,并详细演示了前、后端开发,以及如何免AK配置控制云产品
5758

5859
Gin在Go语言的Web开发社区中非常受欢迎,并且拥有大量的用户和贡献者。它的简洁性、性能和灵活性使得它成为许多Go语言开发者的首选框架。Gin在GitHub等代码托管平台上的star数和fork数都很高,这表明了它的广泛使用和影响力。
5960

@@ -63,6 +64,12 @@ Gin框架的应用场景非常广泛,如:RESTful API开发、Web服务开发
6364

6465
</appdetail>
6566

67+
68+
69+
70+
71+
72+
6673
## 使用流程
6774

6875
<usedetail id="flushContent">
@@ -73,11 +80,24 @@ Gin框架的应用场景非常广泛,如:RESTful API开发、Web服务开发
7380

7481
此时,使用浏览器或者 curl 工具, 就可以对测试域名进行请求:
7582

76-
![](https://img.alicdn.com/imgextra/i4/O1CN01fkEpBv1RNqikaJThO_!!6000000002100-0-tps-3420-398.jpg)
83+
![](https://img.alicdn.com/imgextra/i4/O1CN01RVe9KX1r4JtLpB1AZ_!!6000000005577-0-tps-1678-746.jpg)
7784

7885
</usedetail>
7986

80-
## 注意事项
87+
## 二次开发指南
88+
89+
<development id="flushContent">
90+
91+
本项目可以用于二次开发。
92+
93+
初始化项目时,需要绑定代码仓库,CAP平台会自动配置代码仓库的Webhook。当仓库对应的分支有任何提交时,CAP平台会收到Webhook推送,并自动完成构建与部署。
94+
95+
代码中演示了进行前、后端开发以及访问云产品,用户可以仿造演示代码开发任何自己想要的功能。
96+
97+
</development>
98+
99+
100+
101+
102+
81103

82-
<matters id="flushContent">
83-
</matters>
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
start_gin:
22
default:
33
languages:
4-
- go1.8
4+
- go1.18
5+
cache:
6+
paths:
7+
- "$GOPATH/pkg/mod"
58
steps:
6-
- run: GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o target/main
7-
path: ./code
9+
- run: go mod tidy
10+
path: ./myapp
11+
- run: GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o main
12+
path: ./myapp

web-framework/go/gin/src/code/go.mod

Lines changed: 0 additions & 26 deletions
This file was deleted.

web-framework/go/gin/src/code/go.sum

Lines changed: 0 additions & 95 deletions
This file was deleted.

web-framework/go/gin/src/code/main.go

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
go.mod
2+
go.sum
3+
main.go
4+
vendor/
5+
src/
6+
pkg/
7+
bin/
8+
.fcignore
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
body {
2+
font-family: Arial, sans-serif;
3+
}
4+
5+
h1 {
6+
color: #333;
7+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
module myapp
2+
3+
go 1.18
4+
5+
require (
6+
github.com/aliyun/aliyun-oss-go-sdk v2.2.6+incompatible
7+
github.com/gin-gonic/gin v1.10.0
8+
github.com/google/uuid v1.6.0
9+
github.com/pkg/errors v0.9.1
10+
github.com/sirupsen/logrus v1.9.3
11+
)
12+
13+
require (
14+
github.com/bytedance/sonic v1.11.8 // indirect
15+
github.com/bytedance/sonic/loader v0.1.1 // indirect
16+
github.com/cloudwego/base64x v0.1.4 // indirect
17+
github.com/cloudwego/iasm v0.2.0 // indirect
18+
github.com/gabriel-vasile/mimetype v1.4.4 // indirect
19+
github.com/gin-contrib/sse v0.1.0 // indirect
20+
github.com/go-playground/locales v0.14.1 // indirect
21+
github.com/go-playground/universal-translator v0.18.1 // indirect
22+
github.com/go-playground/validator/v10 v10.21.0 // indirect
23+
github.com/goccy/go-json v0.10.3 // indirect
24+
github.com/json-iterator/go v1.1.12 // indirect
25+
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
26+
github.com/leodido/go-urn v1.4.0 // indirect
27+
github.com/mattn/go-isatty v0.0.20 // indirect
28+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
29+
github.com/modern-go/reflect2 v1.0.2 // indirect
30+
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
31+
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
32+
github.com/ugorji/go/codec v1.2.12 // indirect
33+
golang.org/x/arch v0.8.0 // indirect
34+
golang.org/x/crypto v0.23.0 // indirect
35+
golang.org/x/net v0.25.0 // indirect
36+
golang.org/x/sys v0.20.0 // indirect
37+
golang.org/x/text v0.15.0 // indirect
38+
golang.org/x/time v0.5.0 // indirect
39+
google.golang.org/protobuf v1.34.1 // indirect
40+
gopkg.in/yaml.v3 v3.0.1 // indirect
41+
)

0 commit comments

Comments
 (0)