mirror of
https://github.com/serverless/serverless.git
synced 2026-01-25 15:07:39 +00:00
Using external libraries in Node.js service
Make sure serverless is installed. See installation guide
1. Install dependencies
For this example we are going to install the faker module from npm.
npm install faker --save
2. Use the faker module in your handler.js file
Inside of handler.js require your module.
const faker = require('faker');
3. Deploy
serverless deploy
4. Invoke
serverless invoke -f helloRandomName
In your terminal window you should see the response from AWS Lambda
{
"message": "Hello Floyd"
}