serverless-micro
Advanced tools
Comparing version
@@ -48,3 +48,3 @@ 'use strict'; | ||
gateway: { | ||
usage: 'Specify the stage you want to deploy (e.g. "--stage prod or "-s prod")', | ||
usage: 'Add this flag if you want to setup an API Gateway (e.g. "--gateway or "-g")', | ||
required: false, | ||
@@ -51,0 +51,0 @@ shortcut: 'g' |
@@ -190,3 +190,3 @@ | ||
removeEventsFromFunctions(functions) { | ||
processEventsAndFunctions(functions, add_gateway) { | ||
const _this = this; | ||
@@ -197,3 +197,3 @@ return new Promise(function(resolve, reject) { | ||
if ( !functions.hasOwnProperty(i) ) return; | ||
delete functions[i].events; | ||
if (!add_gateway) delete functions[i].events; | ||
} | ||
@@ -215,9 +215,3 @@ return resolve(functions); | ||
if (( service && (service === service_id) ) || (!service)) { | ||
// NOTE: Should we make this optional??? | ||
// if (!gateway) { | ||
// | ||
// } else { | ||
// | ||
// } | ||
_this.removeEventsFromFunctions(functions) | ||
_this.processEventsAndFunctions(functions, gateway) | ||
.then(function(functions) { | ||
@@ -224,0 +218,0 @@ _this.copyHandler(service_id) |
{ | ||
"name": "serverless-micro", | ||
"version": "0.0.3", | ||
"version": "0.0.5", | ||
"description": "this is the serverless plugin to help manage multiple micro services under one main service.", | ||
@@ -23,6 +23,4 @@ "main": "index.js", | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"dependencies": { | ||
"async": "^2.5.0", | ||
"chai": "^4.1.2", | ||
"child_process": "^1.0.2", | ||
@@ -32,8 +30,11 @@ "copy": "^0.3.1", | ||
"lodash": "^4.17.4", | ||
"mocha": "^3.4.0", | ||
"pre-commit": "^1.2.2", | ||
"sinon": "^2.3.8", | ||
"write": "^1.0.3", | ||
"yamljs": "^0.3.0" | ||
}, | ||
"devDependencies": { | ||
"chai": "^4.1.2", | ||
"mocha": "^3.4.0", | ||
"pre-commit": "^1.2.2", | ||
"sinon": "^2.3.8" | ||
}, | ||
"homepage": "https://github.com/barstoolsports/serverless-micro#readme", | ||
@@ -40,0 +41,0 @@ "scripts": { |
@@ -11,2 +11,20 @@ # serverless-micro | ||
## Structure | ||
To get this plugin working properly, you have to setup your folder structure in a specific way. Again the goal is to make this more universal so it doesn't matter what folder structure you have setup, but with dependencies be included in the handler files and mixing placement of lambdas, this get's very tricky. | ||
```yaml | ||
my_project: | ||
serverless.yml | ||
node_modules | ||
lib | ||
tests | ||
handlers | ||
service_1.js | ||
service_2.js | ||
service_3.js | ||
``` | ||
This is something we are focused on making improving, however, separating out the logic this way has worked really well, and enables a really good process. | ||
## Installation | ||
@@ -31,3 +49,3 @@ | ||
Add the service name to each of your methods. | ||
Using the folder structure above, you then add the service name to each of your methods and separate them out. | ||
@@ -42,8 +60,8 @@ ```yaml | ||
fetchStories: | ||
handler: "handlers/fetchStories" | ||
handler: "handlers/service_1.serviceOneMethod" | ||
events: | ||
- http: | ||
path: /stories | ||
path: /serviceOne | ||
method: get | ||
service: stories | ||
service: service_1 | ||
@@ -53,8 +71,8 @@ # Podcasts | ||
fetchPodcasts: | ||
handler: "handlers/fetchPodcasts" | ||
handler: "handlers/service_2.serviceTwoMethod" | ||
events: | ||
- http: | ||
path: /podcasts | ||
path: /serviceTwo | ||
method: get | ||
service: podcasts | ||
service: service_2 | ||
@@ -64,8 +82,8 @@ # Videos | ||
fetchVideos: | ||
handler: "handlers/fetchVideos" | ||
handler: "handlers/service_3.serviceThreeMethod" | ||
events: | ||
- http: | ||
path: /videos | ||
path: /serviceThree | ||
method: get | ||
service: videos | ||
service: service_3 | ||
@@ -85,2 +103,2 @@ ``` | ||
We welcome pull requests! Please fork the repo and submit your PR. | ||
http://mcsorleys.barstoolsports.com/feed/the-podfathers | ||
https://github.com/BarstoolSports/serverless-micro |
16892
3.89%4
-63.64%99
22.22%7
Infinity%408
-1.45%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added