This is a project what created by me when I was first starting with serverless. Serverless sounded really awesome with all its benefits. But, as a developer before starting the most important aspects like local execution and debugging were not straight forward.
This project is an attempt to help new developers adopting serverless. This project conatins all the necessary tools to help you with local hosting of the APIs and the debugging.
The project is written on Visual Studio Code, and the application can be debugged on the same.
I have added the following dev dependencies:
- serverless (npm install serverless --save-dev)
- serverless-offline (npm install serverless-offline --save-dev)
- Add the serverless-offline plugin in your serverless.yaml file.
- For every function create a Run Configuration in the launch.json file.
serverless offline start
- Open Project in VS Code.
- In the Debug Section Add a New Connfiguration
- Create a new run configuration as show in .vscode/launch.json file. This is the same as sls local invoke, but the execution will now be done by VS Code so now the function will be debuggable.