Clone the project and spin it up. This project was used as an example on a Medium series on how to create a serverless app and set it up with CI/CD.
Have serverless installed locally and on your CI/CD pipeline:
npm install -g serverless
Make sure that you have your AWS Key and Secret in your env vars or bash profile:
export AWS_ACCESS_KEY_ID="YOUR_ACCESS_KEY_ID"
export AWS_SECRET_ACCESS_KEY="YOUR_SECRET_ACCESS_KEY"
To deploy to AWS locally, make sure you have your AWS key and secret in your bash profile and execute the following:
sls deploy -v
To execute locally, run the following command (npm install serverless -g is required):
sls offline --noAuth
or
npm start
If running locally, the beginning of your url will be http://localhost:3000
Then you can send the request to "http:///drug/search/getDrugIdentifiers" using query string parameters like below:
drugName=<drugName>
The sample postman for local server testing has been added to the /misc/postman directory as a Postman Collection.
Successful Email Submission Response: Sample Response
Error Response where query string parameters are null:
{
"error": "Query is empty!"
}
Please find the travisci settings in the project root. Alternatively, if you would like to use Codeship, the following setup is currently used:
Setup Commands
npm install
npm i serverless -g
Test Commands
npm test
Deploy Commands (set for master) In the environment variables, the AWS creds are setup along with the INFO_EMAIL that is grabbed via env.yml.
sls deploy -v