Skip to content

Instantly share code, notes, and snippets.

package middleware
import (
"fmt"
"log"
"os"
"github.com/gin-contrib/sessions"
"github.com/gin-contrib/sessions/redis"
"github.com/gin-gonic/gin"
# The manifest for the "admin" service.
# Read the full specification for the "Request-Driven Web Service" type at:
# https://aws.github.io/copilot-cli/docs/manifest/rd-web-service/
# Your service name will be used in naming your resources like log groups, App Runner services, etc.
name: admin
# The "architecture" of the service you're running.
type: Request-Driven Web Service
image:
# The manifest for the "admin" service.
# Read the full specification for the "Request-Driven Web Service" type at:
# https://aws.github.io/copilot-cli/docs/manifest/rd-web-service/
# Your service name will be used in naming your resources like log groups, App Runner services, etc.
name: admin
# The "architecture" of the service you're running.
type: Request-Driven Web Service
image:
Parameters:
App:
Type: String
Description: Your application's name.
Env:
Type: String
Description: The environment name your service, job, or workflow is being deployed to.
Name:
Type: String
Description: The name of the service, job, or workflow being deployed.
FROM golang:1.18
WORKDIR /usr/src/app
# pre-fetch the dependencies in a separate layer
COPY go.mod go.sum ./
RUN go mod download && go mod verify
# copy in the full codebase and build
COPY . .
package main
import (
"github.com/gin-gonic/gin"
"github.com/jsonw23/copilot-react-admin/middleware"
)
func main() {
r := gin.Default()
package middleware
import (
"github.com/gin-contrib/sessions"
"github.com/gin-contrib/sessions/cookie"
"github.com/gin-gonic/gin"
)
func Auth(r *gin.Engine) gin.HandlerFunc {
store := cookie.NewStore([]byte("secret"))
package main
import "github.com/gin-gonic/gin"
func main() {
r := gin.Default()
r.GET("/", func(c *gin.Context) {
c.JSON(200, gin.H{
"message": "Hello, World",
@jsonw23
jsonw23 / template.yaml
Created June 25, 2020 05:26
Globals with the OpenApiVersion
Globals:
Function:
Timeout: 3
Api:
# this one weird trick...
OpenApiVersion: 3.0.3
Outputs:
HelloWorldFunctionApi:
  Description: "The URL that will trigger our HelloWorldFunction"
  Value: !Sub "https://${Api}.execute-api.${AWS::Region}.amazonaws.com/${ApiStageName}/hello/"