Skip to content

a blue print to start building a microservice using typescript, serverless and microgamma

License

Notifications You must be signed in to change notification settings

microgamma/serverless-apigator-blue-print

Repository files navigation

Serverless Apigator Blue Print

Use this package to get your microservice up and running using Typescript, Serverless and @microgamma

How to use

  • clone this repo

  • install (we suggest to use yarn):yarn

  • personalize: edit serverless.yml's service name

     service: my-first-apigator # NOTE: update this with your service name  
  • develop: create your service such as:

     import { Endpoint, Lambda } from '@microgamma/apigator';  
       
     @Endpoint({  
       cors: true,  
       name: 'my-first-service',  
       private: false  
     })  
     export class MyFirstService {  
       
       @Lambda({  
         method: 'GET',  
         path: '/'  
       })  
       public index() {  
         return `Hello world! Today is ${new Date().toISOString()}`;  
       }  
     }  
  • build: yarn build

  • deploy: yarn sls deploy --stage dev should output something such as:

     endpoints:  
       GET - https://xxxxxxx.execute-api.eu-west-2.amazonaws.com/dev/  
  • open your browser and hit that endpoint ;) or curl https://xxxxxxx.execute-api.eu-west-2.amazonaws.com/dev/

Run locally within express.js

environment=local yarn ts-node src/express.server.ts

#TBD:

  • migrate testing to jest
  • write unit test for lambda
  • add example for dynamodb
  • add example for mongodb
  • add integration tests examples

About

a blue print to start building a microservice using typescript, serverless and microgamma

Resources

License

Stars

Watchers

Forks

Packages

No packages published