Skip to content

feat: upgrade gin flask example. #215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: dipper
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion web-framework/go/gin/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Type: Project
Name: start-gin-cap
Provider:
- 阿里云
Version: 0.0.5
Version: dev
Description: 本案例展示了如何将 Gin,Go 语言社区中倍受追捧的轻量级 Web 框架,迅速构建并部署至云原生应用开发平台(CAP)。Gin 凭借其高效的处理能力、极简设计及高度灵活性,赢得了众多 Go 开发者的芳心,成为快速开发高质量 Web 应用和服务的首选武器。
HomePage: https://github.com/devsapp/start-web-framework/tree/dipper/web-framework/go/gin
Organization: 阿里云函数计算(FC)
Expand All @@ -12,6 +12,7 @@ Tags:
- Web框架
- gin
- Custom Runtime
- Develop
Category: Web框架
Service:
函数计算:
Expand All @@ -26,6 +27,7 @@ Parameters:
required: # 必填项
- region
- functionName
- roleArn
properties:
region:
title: 地域
Expand Down Expand Up @@ -58,3 +60,17 @@ Parameters:
default: gin-${default-suffix}
pattern: "^[a-zA-Z_][a-zA-Z0-9-_]{0,127}$"
description: 函数名称,只能包含字母、数字、下划线和中划线。不能以数字、中划线开头。长度在 1-128 之间
roleArn:
title: 服务角色ARN
type: string
default: "AliyunFCDefaultRole"
pattern: "^acs:ram::[0-9]*:role/.*$"
description: "函数计算访问其他云服务时使用的服务角色,需要填写具体的角色ARN,格式为acs:ram::$account-id>:role/$role-name。例如:acs:ram::14310000000:role/aliyunfcdefaultrole。
\n如果您没有特殊要求,可以使用函数计算提供的默认的服务角色,即AliyunFCDefaultRole。如果您首次使用函数计算,可以访问 https://fcnext.console.aliyun.com 进行授权。
\n详细文档参考 https://help.aliyun.com/document_detail/181589.html?spm=5176.fcnext.help.dexternal.7bea78c8sVHoRf#section-o93-dbr-z6o"
x-role:
name: AliyunFCDefaultRole
service: fc
authorities:
- AliyunOSSFullAccess
- AliyunFCDefaultRolePolicy
8 changes: 5 additions & 3 deletions web-framework/go/gin/src/build.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
start_gin:
default:
languages:
- go1.8
- go1.18
steps:
- run: GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o target/main
path: ./code
- run: go mod tidy
path: ./myapp
- run: GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o main
path: ./myapp
26 changes: 0 additions & 26 deletions web-framework/go/gin/src/code/go.mod

This file was deleted.

95 changes: 0 additions & 95 deletions web-framework/go/gin/src/code/go.sum

This file was deleted.

28 changes: 0 additions & 28 deletions web-framework/go/gin/src/code/main.go

This file was deleted.

8 changes: 8 additions & 0 deletions web-framework/go/gin/src/myapp/.fcignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
go.mod
go.sum
main.go
vendor/
src/
pkg/
bin/
.fcignore
7 changes: 7 additions & 0 deletions web-framework/go/gin/src/myapp/assets/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
body {
font-family: Arial, sans-serif;
}

h1 {
color: #333;
}
41 changes: 41 additions & 0 deletions web-framework/go/gin/src/myapp/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
module myapp

go 1.18

require (
github.com/aliyun/aliyun-oss-go-sdk v2.2.6+incompatible
github.com/gin-gonic/gin v1.10.0
github.com/google/uuid v1.6.0
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.3
)

require (
github.com/bytedance/sonic v1.11.8 // indirect
github.com/bytedance/sonic/loader v0.1.1 // indirect
github.com/cloudwego/base64x v0.1.4 // indirect
github.com/cloudwego/iasm v0.2.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.4 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.21.0 // indirect
github.com/goccy/go-json v0.10.3 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
golang.org/x/arch v0.8.0 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading