kepford / serverless-sqs-example

Example using Serverless framework to log data to a SQS queue.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Serverless SQS Example

This project uses the Serverless framework. You can get started by following this guide.

Setup

You will need to following things set up before you can contribute to this project.

  1. An AWS account.
  2. The AWS CLI installed. Guide
  3. Create an AWS user. Guide

Install correct version of Node

nvm use

Install all the things

npm install

AWS CLI

For convenience install the AWS CLI. Then configure your new CLI by following this guide

Local development

Run npm run serverless offline start

Testing Locally

npm run serverless -- invoke -f functionName -l

Watching Log for a Function

npm run serverless -- logs -f hello -s dev -t Tail the logs on dev for function named hello.

Deployment

Deploy all project code

npm run serverless -- deploy

Deploy one function

npm run serverless -- deploy -f functionName -s dev Deploys the function named functionName to the dev environment.

Deploy to specific environments

The default environment we use is dev so if you wanted to deploy to prod environment you would do -s prod.

npm run serverless -- deploy -s prod

Testing

Simulate a form post which is what we are doing in jQuery when a user views a page.

Note: using HTTPie in these examples. You could use curl or Postman if you like. Note: You will need to update the URL to be the current one you are testing.

http --form POST http://someawsurl.com drupalNid='8741' contactId='003A000001FLKNxIAP' userId='44361' viewedAt='1528994519040'

About

Example using Serverless framework to log data to a SQS queue.

License:GNU General Public License v3.0


Languages

Language:JavaScript 100.0%