Skip to content

Latest commit

 

History

History
34 lines (24 loc) · 1.7 KB

README.md

File metadata and controls

34 lines (24 loc) · 1.7 KB

Twilio Hangman with Express

A GitHub walkthrough based off of this tutorial

Prereqs

  1. Have a valid SMS number that can be used for testing
  2. Have Node.js
  3. Have a Twilio account with a valid phone number

Set Up

  1. Fork this repository and clone your fork to your local computer
  2. cd into this repository through your terminal
  3. Run npm install to download the necessary packages
  4. In the terminal, run npm install twilio express-session -- this is going to be the basis of our edits today
  5. npm install express-generator -g
  6. npm install twilio-cli -g
  7. Open app.js
  8. Add the appropriate requirements:

var session = require('express-session'); after the imports

app.use(session({ secret: 'twilio rocks', resave: false, saveUninitialized: false})); after app is defined. Note: you wouldn't use a secret like 'twilio rocks' in production, this is only for workshop purposes

  1. Run npm start in your terminal to verify that nothing throws an exception
  2. Go to routes/index.js
  3. Follow the notes made on that page to complete the workshop, starting with the INTRO SECTION on line 15.

Running the Game

  1. Make sure you're running your local server by using npm start
  2. Open another tab in terminal and run twilio login and log in with the credentials found in your Twilio console
  3. Run twilio phone-numbers:update "+yournumber" --sms-url="http://localhost:3000/play-game" where yournumber is instead a 11-digit phone number, i.e. +18005551234