express-lambda
Version:
Make AWS lambda behave like an express app
24 lines (20 loc) • 989 B
JavaScript
var program = require("commander");
var path = require("path");
var shell = require("shelljs");
program.command("deploy <srcFile>").description("Create api gateway and deploy lambda functions").action(function (srcFile) {
srcFile = path.resolve(process.cwd(), path.normalize(srcFile));
require("../").load(srcFile).build();
});
program.command("init").description("Initializes a new express-lambda project").action(function () {
console.log("Initializing project...");
var samplePath = path.resolve(__dirname, "../../sample");
var version = require("../../package.json").version;
shell.exec("cp -r \"" + samplePath + "/.\" \"" + process.cwd() + "\"");
shell.exec("npm install express-lambda@" + version + " --save", { silent: true });
console.log("Project initialized.");
console.log("Please specify the AWS Role ARN in the .env file");
console.log("Run 'express-lambda deploy app.js' to deploy!");
});
program.parse(process.argv);
;