Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@barstoolsports/serverless-micro

Package Overview
Dependencies
Maintainers
2
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@barstoolsports/serverless-micro

this is the serverless plugin to help manage multiple micro services under one main service.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

serverless-micro

Serverless framework plugin to help manage multiple micro services under one main service.

A limit of Cloudformation is it can only hold 200 objects. This becomes problematic when you are dealing with even a medium sized API and the Serverless framework. This plugin aims to split up the methods outlined in the main Serverless file, to multiple services, and give you the flexibility to deploy those services individually.

What this doesn't do...yet.

This plugin does not setup a main API Gateway file for you, although it is a major priority. Currently, this still has to be managed using AWS and API Gateway.

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.

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

Install the plugin from npm

$ npm install --save-dev serverless-micro

Usage

Add the plugin to your serverless.yml

# serverless.yml

plugins:
  - serverless-micro

Using the folder structure above, you then add the service name to each of your methods and separate them out.

# serverless.yml

functions:

  # Stories

  fetchStories:
    handler: "handlers/service_1.serviceOneMethod"
    events:
      - http:
          path: /serviceOne
          method: get
    service: service_1

  # Podcasts

  fetchPodcasts:
    handler: "handlers/service_2.serviceTwoMethod"
    events:
      - http:
          path: /serviceTwo
          method: get
    service: service_2

  # Videos

  fetchVideos:
    handler: "handlers/service_3.serviceThreeMethod"
    events:
      - http:
          path: /serviceThree
          method: get
    service: service_3

Once services are setup deploy using new hook.

$ sls deploy micro --service stories
$ sls deploy micro --service stories --stage prod
$ sls deploy micro --service stories --stage prod --function fetchStories

Contributing

We welcome pull requests! Please fork the repo and submit your PR. https://github.com/BarstoolSports/serverless-micro

Keywords

FAQs

Package last updated on 07 Jan 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc