Skip to content

joadva/Serverles-Plantilla-Node-Js

Repository files navigation

Serverless Framework AWS NodeJS Example

This template demonstrates how to deploy a NodeJS function running on AWS Lambda using the traditional Serverless Framework. The deployed function does not include any event definitions as well as any kind of persistence (database). For more advanced configurations check out the examples repo which includes integrations with SQS, DynamoDB or examples of functions that are triggered in cron-like manner. For details about configuration of specific events, please refer to our documentation.

Usage

Deployment

In order to deploy the example, you need to run the following command:

$ serverless deploy

Local use

$ serverless offline

After running deploy, you should see output similar to:

Deploying aws-node-project to stage dev (us-east-1)

✔ Service deployed to stack aws-node-project-dev (112s)

functions:
  hello: aws-node-project-dev-hello (1.5 kB)

Invocation

After successful deployment, you can invoke the deployed function by using the following command:

serverless invoke --function hello

Which should result in response similar to the following:

{
  "statusCode": 200,
  "body": "{\n  \"message\": \"Go Serverless v3.0! Your function executed successfully!\",\n  \"input\": {}\n}"
}

Local development

You can invoke your function locally by using the following command:

serverless invoke local --function hello

Which should result in response similar to the following:

{
    "statusCode": 200,
    "body": "{\n  \"message\": \"Go Serverless v3.0! Your function executed successfully!\",\n  \"input\": \"\"\n}"
}

Example create Model And migration with cli Sequelize

npx sequelize-cli model:generate --name Compra --attributes  status:string,total:string

Runing a migration

npx sequelize-cli db:migrate

Librarys

  1. node input validator.
  2. sequelzie.
  3. sls offline.
  4. jest.
  5. supertest.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors