DEV Community

mkop
mkop

Posted on • Updated on

How to Use Serverless with NestJS

Alt Text

Need an example of how to get started with NestJS and Serverless framework?

NestJS is a back-end framework for creating scalable applications.

Getting Started

NestJS

To start playing with NestJS you should have node (version >= 8.9.0) and npm installed. You can download and install Node from the official website.

Create a database automatically

docker run --name mysql57 -p 3306:3306 \
-e MYSQL_ROOT_PASSWORD=superpassword \
-e MYSQL_USER=user \
-e MYSQL_PASSWORD=pass \
-e MYSQL_DATABASE=mydb \
-d mysql/mysql-server:5.7
Enter fullscreen mode Exit fullscreen mode

Serverless framework

For serverless you need to install the required package globally:

npm install serverless -g

To follow this tutorial, you are going to need clone repository NestJS-Serverless-TypeOrm

Now just start application:

npm run sls:offline

Let's create the first author in the application


You can try crud operations on Author

That's it!

Feel free to ask questions, make comments or suggestions, or just say hello in the comments below.

Latest comments (1)

Collapse
 
fernando1989mg profile image
Fernando Muñoz

this is pure gold brother! thx!