Coder Social home page Coder Social logo

jasonumiker / serverless-multicloud-example Goto Github PK

View Code? Open in Web Editor NEW
20.0 4.0 7.0 828 KB

An example Node Express app that can be deployed in any major cloud by the Serverless framework

JavaScript 100.00%
aws-lambda azure-functions google-cloud-functions serverless-framework nodejs express

serverless-multicloud-example's Introduction

serverless-multicloud-example

This is the example for my blog post - Blog Post

An example Node Express app that can be deployed in any of the major clouds by the Serverless framework (https://serverless.com). The differences in handler for each serverless service is abstracted by the serverless-express plugin (https://www.npmjs.com/package/serverless-express) - which has been isolated in handler.js - leaving app.js for our cloud-agnostic business logic.

I intend for it to be a working example of the serverless without lock-in concepts discussed here - https://www.thoughtworks.com/insights/blog/mitigating-serverless-lock-fears

To use copy the relevant severless-xxx.yml file for the cloud you want (AWS, GCP or Azure) to serverless.yml and do a sls deploy.

You also need to provide an Internet-facing Mongo URL via environment variable in the serverless-xxx.yml file to use the Mongo CRUD functionality (all the /document APIs).

Note that for GCP some initial setup is required as described here - https://serverless.com/framework/docs/providers/google/guide/credentials/. The other clouds you just need valid login details and CLIs configured to proceed.

Note that for Azure the URIs have to start with /api/app and in Google they have to start with /handler. I am investigating how to have them start at the root like in AWS.

For the AWS side you can use the offline testing functionality by doing a sls offline.

The example app is a todo list application with a description and due date field for each task.

The APIs are:
GET - / - App description and version
POST - /documents/new - Create a task/document (takes two parameters - description and duedate)
GET - /documents/all - Return all tasks/documents
GET - /documents/id - Return a particular document by ID (via id parameter)
DELETE - /documents/id - Delete a particular document by ID (via id parameter)
PATCH - /documents/id - Update a particular document by ID (via id parameter and it takes description and/or duedate as the fields to update)

serverless-multicloud-example's People

Contributors

jasonumiker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.