Webhook handling for Migraine Again
npm install @evdy-consumer/cloudcms-internal-apicloudcms-internal-api> Lambda for our internal apis available to use with CloudCMS
* Install lerna globally if you haven't already: npm install -g lerna
* Copy env-template to .env
* Add .env-local to /env/(do|li|ma|recipes)/ folders
* Install dependencies: lerna bootstrap
To compile the source and start the service:
- Run yarn run dev:do, yarn run dev:li, or yarn run dev:ma to get the respective projects running
- Optionally you can run yarn run dev as long as you have PROJECT and local set as variables in the terminal in which you are starting the app
- Example: If you want to start the project in nodemon dev mode dailyom but point to staging env variables you would run export PROJECT=do && export ENV=staging && yarn run dev
- alternatively you can update the yarn run dev:do command to point to staging instead of local
yarn build:dockerdocker build -t internal-api --build-arg NPM_TOKEN=$NPM_TOKEN .docker run -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN internal-apiyarn build:dockerdocker build --build-arg NPM_TOKEN=$NPM_TOKEN -t internal-api-aws --progress=plain --no-cache -f Dockerfile-aws ../ --debugdocker run -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN -p 3000:3000 internal-api-aws* To transpile the source, start the service and watch for any changes: yarn watch
> NOTE: At the time of writing this there is an occasional issue with the watch script. If you run into that, you can run the build and run scripts. Alternatively, and preferably, you can fix the watch issue :trollface:
#### Watch additional packages within the lerna repo and restart
* To trigger a restart of cloudcms-api-proxy when changes are made within other packages within this lerna repo, add it's lib/ or dist/ directory to the "watch" array within nodemon.json. Then run lerna run watch
To run in debug mode, you can start the application with serverless offline like this
```
node --inspect-brk ../../node_modules/serverless/bin/serverless.js offline
Then follow these instructions for opening chrome dev tools for debugging the application
To see all supported endpoints, please reference the functions section in serverless.yml
To view the source for one of those functions/endpoints, you can check the handler value, and then look for that file within the src directory instead of lib` directory