This file contains 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
import boto3 | |
def lambda_handler(event, context): | |
dynamodb = boto3.resource('dynamodb') | |
table = dynamodb.Table('agentNumbersDb') | |
print(event) | |
## Find which number was dialed by customer. | |
## You may need to do some string manipulation to remove the "+" in the phone number. | |
dialedNumber = event['Details']['SystemEndpoint']['Address'] |
This file contains 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
var express = require('express') | |
var app = express() | |
var request = require('request') | |
var bodyParser = require('body-parser') | |
// Middleware to convert SNS request message body from plain text to JSON | |
var convertToJson = function (req, res, next) { | |
if (req.headers['x-amz-sns-message-type']) { | |
req.headers['content-type'] = 'application/json;charset=UTF-8'; | |
} |
This file contains 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
angular.module("contactsApp", ['ngRoute']) | |
.config(function($routeProvider) { | |
$routeProvider | |
.when("/", { | |
templateUrl: "list.html", | |
controller: "ListController", | |
resolve: { | |
contacts: function(Contacts) { | |
return Contacts.getContacts(); | |
} |
This file contains 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
var express = require("express"); | |
var path = require("path"); | |
var bodyParser = require("body-parser"); | |
var mongodb = require("mongodb"); | |
var ObjectId = require("mongodb").ObjectID; | |
var app = express(); | |
app.use(express.static(__dirname + "/public")); | |
app.use(bodyParser.json()); // for parsing application/json | |
app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded |
This file contains 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
app.post("/contacts", function(req, res) { | |
var newDoc = req.body; | |
newDoc.createDate = new Date(); | |
if (req.body.firstName === undefined || req.body.lastName === undefined) { | |
handleError(null, res, "Must provide a contact name."); | |
} | |
if (req.body.email === undefined) { | |
handleError(null, res, "Must provide an email."); |
This file contains 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
{ | |
"_id": <ObjectId> | |
"firstName": <string>, | |
"lastName": <string>, | |
"email": <string>, | |
"phoneNumbers": { | |
"mobile": <string>, | |
"work": <string> | |
} | |
"twitterHandle": <string>, |
This file contains 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
angular.module("todolists", ["ui.bootstrap", "ui", "ngRoute"]) | |
.config(function($routeProvider) { | |
$routeProvider | |
.when("/", { | |
controller: "TodolistController as todolist", | |
templateUrl: "todolists.html", | |
resolve: { | |
todolists: function(Todolists) { | |
return Todolists.getTodolists(); | |
} |
This file contains 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
// Todolist | |
{ | |
_id: <string>, | |
name: <string>, | |
createDate: <Date>, | |
[todos: <Array>] // <Array of Todos">? | |
} | |
// Todo | |
{ |
This file contains 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
//comments: We’ve added some basic input validation to ensure that the basic requirement that every todo list has a name is met. | |
app.post("/todolists", function(req, res) { | |
var postQuery = {createDate: new Date()}; | |
if (req.body.name == "undefined") { | |
handleError(null, res, "Must provide a todolist name"); | |
} | |
postQuery.name = req.body.name; |
This file contains 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
var express = require("express"); | |
var path = require("path"); | |
var bodyParser = require("body-parser"); | |
var mongodb = require("mongodb"); | |
var ObjectID = mongodb.ObjectID; | |
var CONTACTS_COLLECTION = "contacts"; | |
var app = express(); | |
app.use(express.static(__dirname + "/public")); |
NewerOlder