A service that provides you with an easy way to manage potential Leads and their respective Interests.
- Install all dependencies:
npm i
- Install serverless tool globally or use npx
npm i -g serverless
or
npx serverless
- Install DynamoDB
npx sls dynamodb install
- Start application in offline mode:
npm run start:dev
- Also we can invoke a single function:
npm run invoke:local -- -f <functionName>
- We can run function in debug mode to see additional logs
npm run invoke:local:debug -- -f <functionName>
Check the sls invoke local command documentation for more information.
We can use Postman or Insomnia to test api (in future it will be swagger).
- Create a lead
curl --location --request POST 'http://localhost:4500/lead' \
--header 'Content-Type: application/json' \
--data-raw '{
"email":"[email protected]",
"phone":"(012) 2345 6789",
"firstName":"Jack",
"lastName":"Russel"
}'
- Add lead interest (we can get leadId from the previous request)
curl --location --request POST 'http://localhost:4500/interest' \
--header 'Content-Type: application/json' \
--data-raw '{
"leadId": "eab29a17-4f5d-4285-9c71-ed78a7d833b1",
"message": "hello world"
}'
- Find all leads with their interests
curl --location --request GET 'http://localhost:4500/leads' \
--header 'Content-Type: application/json'
The project code base is mainly located within the src
folder. This folder is divided in:
common
- containing common features for the entire projectfunctions
- containing code base and configuration for your lambda functionsmiddlewares
- containing middleware list for each lambda functionmodels
- containing your business modelsservices
- containing abstractions for external servicesutils
- containing tools and helpers
Serverless Framework is configured in:
serverless.ts
- main configuration fileserverless
- a folder with partials configurations
Here's a brief high-level overview of the tech stack the ISD App uses:
- Node.js v.14.17.6 - a JavaScript runtime built on Chrome's V8 JavaScript engine.
- Serverless v.2.70.0 - framework for the creation and management of the Serverless infrastructure
- AWS Cloud Provider - cloud provider with more than 100 products.
- AWS DynamoDB - Amazon DynamoDB is a fully managed, serverless, key-value NoSQL database designed to run high-performance applications at any scale.
- Typescript - is a strongly typed programming language that builds on JavaScript, giving you better tooling at any scale.
Firstly check if you authorized in aws console.
- Build the project before deployment (in folder
.serverless
)
npm run build
- Deploy the whole application to the cloud:
npx run deploy:all
- Deploy a single function
npx run deploy:function -- -f <functionName>
- For more details
npx run deploy:function -- --help
Application services are covered by unit tests with jest. Run tests with npm scripts:
npm run test
or
npm t
- Swagger
- Authorization