This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "functions", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"keywords": [], | |
"author": "", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sls deploy --env qa -v |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run -v "$PWD":/var/task/ lambci/lambda:nodejs8.10 functions/handler.hello |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run \ | |
--env-file ./env/env.variable \ | |
-v "$PWD":/var/task/ \ | |
lambci/lambda:nodejs8.10 \ | |
functions/handler.hello |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"compilerOptions": { | |
"target": "es2015", | |
"checkJs": true, | |
"module": "commonjs" | |
}, | |
"exclude": [ | |
"node_modules", | |
"**/node_modules/*" | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ docker run -v "$PWD":/var/task/ lambci/lambda:build-nodejs8.10 npm install |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const redis = require('redis') | |
const moment = require('moment') | |
const { promisify } = require('util') | |
class TrafficController { | |
/** | |
* @param {string} tokenKey | |
* @param {string} redisHost | |
*/ | |
constructor (tokenKey, redisHost) { |
NewerOlder