Skip to content

Instantly share code, notes, and snippets.

View goldstack.json
{
"$schema": "./schemas/package.schema.json",
"name": "lambda-express-template",
"template": "lambda-express",
"templateVersion": "0.1.0",
"configuration": {},
"deployments": [
{
"name": "prod",
"awsRegion": "us-west-2",
View templateLambdaExpressDeploy.ts
awsCli({
credentials: await getAWSUser(params.deployment.awsUser),
region: params.deployment.awsRegion,
command: `lambda update-function-code --function-name ${readTerraformStateVariable(
params.deploymentState,
'lambda_function_name'
)} --zip-file fileb://${targetArchive}`,
});
View lambda.tf
resource "aws_lambda_function" "main" {
function_name = var.lambda_name
filename = data.archive_file.empty_lambda.output_path
handler = "lambda.handler"
runtime = "nodejs12.x"
memory_size = 2048
timeout = 900
View next.config.js
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/explicit-function-return-type */
const withPlugins = require('next-compose-plugins');
const getLocalPackages = require('./scripts/getLocalPackages');
const localPackages = getLocalPackages.getLocalPackages();
const withTM = require('next-transpile-modules')(localPackages);
View build.ts
import { build } from 'esbuild';
import { pnpPlugin } from '@yarnpkg/esbuild-plugin-pnp';
build({
plugins: [pnpPlugin()],
bundle: true,
entryPoints: ['src/lambda.ts'],
external: ['aws-sdk'],
minify: true,
format: 'cjs',
View settings.json
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"files.eol": "\n",
"editor.formatOnSave": false
}
View tsconfig.json
{
"compilerOptions": {
"composite": true,
"declaration": true,
"declarationMap": true,
"incremental": true,
"outDir": "./dist",
}
"references": [
{
View config.json
{
"users": [
{
"name": "awsUser",
"type": "apiKey",
"config": {
"awsAccessKeyId": "[Access Key Id]",
"awsSecretAccessKey": "[Secret Access Key]",
"awsDefaultRegion": "us-west-2"
}
View goldstack.json
{
"$schema": "./schemas/package.schema.json",
"name": "lambda-go-gin",
"template": "lambda-go-gin",
"templateVersion": "0.1.1",
"configuration": {},
"deployments": [
{
"name": "dev",
"configuration": {
View server.go
package main
import (
"os"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
)
func CreateServer() *gin.Engine {