February 2019
Beginner
694 pages
18h 4m
English
The sample Lambda function that Serverless has created for us is in a standard JavaScript file named handler.js. Let's now look at how we can use TypeScript to generate a compatible JavaScript file that can be used as a Lambda function. To start off with, let's first initialize npm within this directory as follows:
npm init
This command will create a packages.json file within the serverless-sample directory, so that we can use it to install any node modules that we may need. We can then initialize TypeScript within this directory as per usual:
tsc --init
This will create a tsconfig.json file, which is ready for TypeScript compilation. To use Lambda functions within TypeScript, we will need to install two packages, ...
Read now
Unlock full access