Use this package to get your microservice up and running using Typescript, Serverless and @microgamma
-
clone this repo
-
install (we suggest to use yarn):
yarn
-
personalize: edit
serverless.yml
's service nameservice: 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/
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