Skip to content

Instantly share code, notes, and snippets.

{
"name": "functions",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
const MTools = require('mtools')
const mtools = new MTools()
/**
* @param {AWSLambda.APIGatewayEvent} event
* @param {AWSLambda.Context} context
* @param {AWSLambda.Callback} callback
*/
module.exports.hello = async (event, context, callback) => {
mtools.exec()
sls deploy --env qa -v
service: my-service
provider:
name: aws
runtime: nodejs8.10
stage: YourSatage
region: ap-northeast-1
deploymentBucket:
name: YOUR_BUCKET_NAME
environment: ${file(./env/env.${opt:env}.yml)}
docker run -v "$PWD":/var/task/ lambci/lambda:nodejs8.10 functions/handler.hello
docker run \
--env-file ./env/env.variable \
-v "$PWD":/var/task/ \
lambci/lambda:nodejs8.10 \
functions/handler.hello
cat tests/data/event1.json | \
docker run \
--env-file ./env/env.variable \
-v "$PWD":/var/task/ \
-i -e DOCKER_LAMBDA_USE_STDIN=1 \
lambci/lambda:nodejs8.10 \
functions/handler.hello
{
"compilerOptions": {
"target": "es2015",
"checkJs": true,
"module": "commonjs"
},
"exclude": [
"node_modules",
"**/node_modules/*"
]
$ docker run -v "$PWD":/var/task/ lambci/lambda:build-nodejs8.10 npm install
const redis = require('redis')
const moment = require('moment')
const { promisify } = require('util')
class TrafficController {
/**
* @param {string} tokenKey
* @param {string} redisHost
*/
constructor (tokenKey, redisHost) {