Is it possible to add an npm package to serverless?

Hello everyone! I am new to serverless / aws lambda and I have a few questions I wanted to ask. First off, is it possible;e for my lambda functions to utilize a js library? For example, if I wanted to us a package called Figlet in my code like such:
module.exports.funny = async (event) => {
var figlet = require(‘figlet’);
let data = figlet(‘Hello World!!’, function (err, data) {
if (err) {
console.log(‘Something went wrong…’);
console.dir(err);
return;
}
return data;
});

  return {
     statusCode: 200,
     headers: {
           "Access-Control-Allow-Origin": "*", // Required for CORS support to work
           "Access-Control-Allow-Credentials": true // Required for cookies, authorization headers with 
            HTTPS
     },
     data: JSON.stringify(data)
 }
}

And if so, how do I achieve this? Thank you very much!

Hi Selke and welcome to the community. It most definitely is possible to use npm modules. You would, however, preferably require your module outside the function instead. This is just a small optimisation. Otherwise you have it right. Just use them like you always have for Node.

See i tried doing this, and when I run the function it does not work. I have ruled out that I am not using the package correctly.

I went to the root folder of the Serverless project and ran npm install geopoint --save . package.json got updated with dependencies": { "geopoint": "^1.0.1" } and node_modules folder was created.

My folder structure looks like this:
root-project-folder
-functions
–geospatial
—handler.js
-node_modules
–geopoint

seriously…?? ??? n it worked??? 9Apps VidMate apk