This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Small demo to show chaining of API calls. We're using these APIs: | |
https://weathers.co for current weather in 3 cities, and | |
https://api.github.com/search/repositories?q=<term> to search GitHub repos for | |
the 'hottest' city. For example, we'll grab weather for 3 cities, pick the hottest one, | |
then hit GitHub with a search for repos that have that city's name. A bit nonsensical | |
but I just wanted to demonstrate using the results of one API call to populate a second. | |
The problem we're trying to solve is that the API calls are asynch, and one of them | |
(getCityTemperatures) loops through several asynch calls (one for each city), and they |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* An example showing OAuth 1.0 against Twitter, based on a post at | |
http://moonlitscript.com/post.cfm/how-to-use-oauth-and-twitter-in-your-node-js-expressjs-app/ | |
Comments are mine - PCD | |
*/ | |
//Get a router instance | |
// | |
const express = require('express') | |
const router = express.Router() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
For this version we'll add a register method to add a user to the database using proper | |
password encryption. It also demonstrates how to add and use a method on a schema. | |
Reference: https://www.sitepoint.com/user-authentication-mean-stack | |
*/ | |
const mongoose = require('mongoose') | |
const crypto = require('crypto') | |
//const findOrCreate = require('mongoose-findorcreate') | |
//Set up ES6 Promises |