Thursday, November 10, 2016

Your first serverless architecture 1.1.0 (Creating project ,functions) running offline with/without endpoint



Install node js:

          https://nodejs.org/en/download/

Install Serverless:
       
  • npm install -g serverless

Create new serverless project:

       
  • serverless create --template aws-nodejs --path my-service
  • cd my-service


inside my-service you will see 3 files 



Then you need to edit serverless.yml





where you need to edit aws-nodejs with you own service name 

you can also give same or different name to your functions

create events with http endpoint


include serverless-offline plugin and also install it by running the following line
npm install serverless-offline --save-dev


you also need to install babel transplier :

npm install --save-dev babel-preset-es2015

npm install --save-dev babel-preset-stage-2


once you are done with it run following cmd 



sls offline -r us-west-2   where -r is to change the region.

then hit localhost:3000/sqlToCass in the browser

to run it locally :

 serverless invoke local --function sqlToCass




1 comment:

  1. As reported by Stanford Medical, It is in fact the ONLY reason women in this country live 10 years more and weigh 19 KG less than us.

    (By the way, it has totally NOTHING to do with genetics or some hard exercise and really, EVERYTHING to about "how" they are eating.)

    P.S, What I said is "HOW", not "WHAT"...

    CLICK this link to see if this little quiz can help you find out your true weight loss potential

    ReplyDelete