GithubHelp home page GithubHelp logo

demo-multi-api-monorepo's Introduction

Stackery Multi-Api Monorepo Example

This repo contains three stacks:

  • Users api
  • Accounts api
  • Top-level API Gateway custom domain

The top-level domain ties the two sub apis together using base path mappings. The users api is mounted at /users, and the accounts api is mounted at /accounnts.

The three stacks can be re-deployed independently, though the two sub-api stacks must exist before the top-level domain stack is provisioned. The sub-api IDs are exported from the sub-api stacks and imported by the top-level domain stack.

Deployment steps

  1. Fork this repo to your own account
  2. Create three Stackery stacks, one for each of the stacks in this repo
  3. Create an environment in Stackery if you don't already have one
  4. Add a custom domain and validation domain to the Stackery environment parameters as "domain" and "validationDomain" properties. This is a requirement to provision the full API in the end, though the sub-apis can be deployed without a domain. When provisioning the domain, emails will be sent to the contact addresses in the DNS registrar info for the validation domain. The validation domain must be the same as the domain or a parent of the domain. Example parameter values:
    {
      "domain": "foo.example.com",
      "validationDomain": "example.com"
    }
    This will send validation emails to the admins of example.com to approve a certificate for foo.example.com. (See https://docs.stackery.io/docs/api/nodes/RestApi/#custom-domain for more info)
  5. Deploy the two sub-api stacks first. This is easiest using our CLI and the local strategy by descending into each directory and running:
    stackery deploy --strategy local --env-name <your Stackery environment name>
    
    An extra configuration step is necessary if you want to do a cloud-side deployment strategy to tell Stackery which template file to use for each stack. You can find more details here: https://docs.stackery.io/docs/using-stackery/mono-repo-apps/#adding-a-mono-repo-in-the-cli
  6. Deploy the top-level domain in the same manner. Make sure to check for an email sent to validate the SSL certificate. Otherwise, your deployment will just sit there for an hour until it times out and rolls back.
  7. Get the custom domain CNAME address from the API Gateway console.
  8. Issue a curl request to test:
    curl https://<custom domain CNAME address>/users/5 -H 'Host: <custom domain>' -v
    
  9. You should receive an empty 200 response (none of the functions are implemented to do anything else)

demo-multi-api-monorepo's People

Contributors

txase avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

arcanereinz

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.