Edit on github

#Fn - Quick Start

#Pre-requisites

  1. Node.js v6.5.0 or later.
  2. Serverless CLI v1.20 or later. You can run npm install -g serverless to install it.
  3. Install Fn & Dependencies(../installation).

#Create a new service

Create a new service using the Nodejs template, specifying a unique name and an optional path for your service.

# Create a new Serverless Service/Project
$ serverless create --template fn-nodejs --path new-project
# Change into the newly created directory
$ cd new-project
# Install npm dependencies
$ npm install

#Deploy, test and diagnose your service

  1. Deploy the Service

    Use this when you have made changes to your Functions, Events or Resources in serverless.yml or you simply want to deploy all changes within your Service at the same time.

    serverless deploy -v
  2. Deploy the Function

    Use this to quickly upload and overwrite your function code, allowing you to develop faster.

    serverless deploy -f hello
  3. Invoke the Function

    Invokes the Function and returns results.

    $ serverless invoke --function hello --data '{"name":"Bob"}' -l
    Serverless: Calling Function: hello
    { message: 'Hello Bob' }
    I show up in the logs name was: Bob
  4. Fetch the Function Logs

    Open up a separate tab in your console and view logs for a specific Function using this command.

    serverless logs -f hello

#Cleanup

If at any point, you no longer need your service, you can run the following command to remove the Functions, Events and Resources that were created.

serverless remove

Made with love in San Francisco + Atlanta, Austria, Germany, Pakistan, Poland, Nebraska & Thailand

Serverless, Inc. © 2018

Join our newsletter and get the latest news about Serverless products and happenings. #noSpamWePromise