Skip to content

rosborne132/encouragement-now-api

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 

About

I built a serverless application that allows users to text kind words to those that are recovering from COVID-19.

One of the main problems for those recovering from COVID-19 is the isolation from loved ones. You can communicate through other means but this application is for those that don't already have a support network.

Local Environment Setup

If you would like to test the application without setting it up to try visiting the live site Encouragement Now

Setup front end site

Follow and complete all the steps in the front end repo first. Front End Repo

Clone this repository and cd into it

git clone https://github.com/rosborne132/encouragement-now-api.git
cd encouragement-now-api

Setup env file

Sample env file

ACCOUNT_SID=
AUTH_TOKEN=
GIPHY_KEY=
PHONE_NUMBER= (Your Twilio number)
SENDER_PHONE_NUMBER= (Your phone number, really only used for tests)
DYNAMODB_TABLE=

Install dependencies

Ensure that you have serverless install globally

npm install -g serverless

After that install the project dependencies

npm install

How to run the application locally

First, deploy the dev environment

sls deploy

Once this is complete you can update the DYNAMODB_TABLE value in your env file.

Start the application by running sls offline The output should look like this.

Serverless: Compiling with Typescript...
Serverless: Using local tsconfig.json
Serverless: Typescript compiled.
Serverless: Watching typescript files...
offline: Starting Offline: dev/us-west-2.
offline: Offline [http for lambda] listening on http://localhost:3002

   ┌────────────────────────────────────────────────────────────────────────────────┐
   │                                                                                │
   │   POST | http://localhost:3000/dev/registeruser                                │
   │   POST | http://localhost:3000/2015-03-31/functions/registerUser/invocations   │
   │   POST | http://localhost:3000/dev/sendtoqueue                                 │
   │   POST | http://localhost:3000/2015-03-31/functions/sendToQueue/invocations    │
   │                                                                                │
   └────────────────────────────────────────────────────────────────────────────────┘

offline: [HTTP] server ready: http://localhost:3000 🚀
offline:
offline: Enter "rp" to replay the last request

Update your twilio #'s webhook with url http://localhost:3000/dev/sendtoqueue
For more information: Link

If you have completed the registration in the front-end site you should be able to directly text the number text

Congrats! That's it!

Tests

You can run the tests locally by typing:

npm test

Cloud deployment

All deployments are handled through serverless.
For more information: Link

About

A serverless api for spreading positivity

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published