diff --git a/.jshintrc b/.jshintrc old mode 100755 new mode 100644 diff --git a/app/controllers/middleware.js b/app/controllers/middleware.js index 7c3821834..4f3fa85c3 100755 --- a/app/controllers/middleware.js +++ b/app/controllers/middleware.js @@ -1,6 +1,5 @@ // Module dependencies. -var - Users = require('../models/users'), +var Users = require('../models/users'), ServantMetas = require('../models/servant_metas'), config = require('../../config/config'); diff --git a/app/lambda/lambda_one.js b/app/lambda/lambda_one.js new file mode 100644 index 000000000..3533de184 --- /dev/null +++ b/app/lambda/lambda_one.js @@ -0,0 +1,13 @@ +/** + * AWS Lambda Task + * - Put tasks in here that take a while to process + * - Then will be uploaded to AWS Lambda and executed there + */ + +module.exports = function(a, b, callback) { + + var answer = a + b; + + return callback(answer); + +}; \ No newline at end of file diff --git a/app/models/product_link.js b/app/models/product_link.js deleted file mode 100644 index 49ed76e95..000000000 --- a/app/models/product_link.js +++ /dev/null @@ -1,61 +0,0 @@ -// Module dependencies. -var mongoose = require('mongoose'), - moment = require('moment'), - Schema = mongoose.Schema; - -/** - * ProductLink - * - Links Etsy Listing ID to a Product ID on Servant - */ -var ProductLinkSchema = new Schema({ - etsy_listing_id: { - type: String, - required: true, - trim: true - }, - servant_product_id: { - type: String, - required: true, - trim: true - }, - etsy_user_id: { - type: String, - required: true, - trim: true, - unique: true - }, - servant_id: { - type: String, - required: true, - trim: true, - unique: true - }, - synced: { - type: Date, - default: Date.now - } -}); - - -/** - * Statics - */ -ProductLinkSchema.statics = { - - /** - * Create Product Sync - * - Creates a Product Link record in the database - */ - - createProductLink: function(etsy_product, servant_product, callback) { - var _this = this; - - // First, check if a ProductLink record exists for either product - - - } -}; - - - -mongoose.model('ProductLink', ProductLinkSchema); \ No newline at end of file diff --git a/app/models/servant_metas.js b/app/models/servant_metas.js index 250f8caa9..22e882ca5 100755 --- a/app/models/servant_metas.js +++ b/app/models/servant_metas.js @@ -2,7 +2,7 @@ * ServantMeta Data Model */ -var dynamoDB = require('../other/aws_client').dynamoDB, +var dynamoDB = require('../other/aws_services').dynamoDB, moment = require('moment'), dynamoDBConverter = require('../other/dynamodb_converter'), crypto = require('crypto'); diff --git a/app/models/users.js b/app/models/users.js index 394f9a18c..aefee3c3c 100755 --- a/app/models/users.js +++ b/app/models/users.js @@ -2,7 +2,7 @@ * Users Data Model */ -var dynamoDB = require('../other/aws_client').dynamoDB, +var dynamoDB = require('../other/aws_services').dynamoDB, dynamoDBConverter = require('../other/dynamodb_converter'), crypto = require('crypto'); diff --git a/app/other/aws_client.js b/app/other/aws_client.js deleted file mode 100644 index 4c20e5f5d..000000000 --- a/app/other/aws_client.js +++ /dev/null @@ -1,9 +0,0 @@ -var AWS = require('aws-sdk'); - -AWS.config.update({ - accessKeyId: process.env.AWS_ACCESS_KEY, - secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY, - region: "us-east-1" -}); - -module.exports.dynamoDB = new AWS.DynamoDB(); \ No newline at end of file diff --git a/app/other/aws_services.js b/app/other/aws_services.js new file mode 100644 index 000000000..81d67f23b --- /dev/null +++ b/app/other/aws_services.js @@ -0,0 +1,28 @@ +/** + * AWS Services + * - Config the AWS Client and other Ahere + * - Require this into your modules instead of configuring the AWS Client everywhere + */ + +var AWS = require('aws-sdk'); +var lambdaws = require('lambdaws'); + +// Config AWS Client +AWS.config.update({ + accessKeyId: process.env.AWS_ACCESS_KEY, + secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY, + region: "us-east-1" +}); + +// Config Lambdaws Module +lambdaws.config({ + credentials: { + accessKey: process.env.AWS_ACCESS_KEY, + secretKey: process.env.AWS_SECRET_ACCESS_KEY, + }, + role: process.env.AWS_LAMBDA_ROLE +}); + +// Export +module.exports.dynamoDB = new AWS.DynamoDB(); +module.exports.lambdaws = lambdaws; diff --git a/app/other/dynamodb_converter.js b/app/other/dynamodb_converter.js index 6e3d46643..fbbc0e14f 100644 --- a/app/other/dynamodb_converter.js +++ b/app/other/dynamodb_converter.js @@ -1,3 +1,10 @@ +/** + * DynamoDB Converter + * - DynamoDB does not take standard JSON (what the f*ck!) + * - Use these to convert DynamoDB results to standard JSON + */ + + var arrayConverter = function(data_in) { var data_out = []; if (!data_in) diff --git a/package.json b/package.json index c227ec8e4..a961e9798 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "express": "^4.12.3", "forever": "^0.11.1", "jade": "^1.9.2", + "lambdaws": "^1.0.15", "lodash": "^2.4.1", "method-override": "^2.3.2", "moment": "^2.9.0", diff --git a/public/fonts/TrendSans-One-webfont.eot b/public/fonts/TrendSans-One-webfont.eot deleted file mode 100755 index 2e55e3d6d..000000000 Binary files a/public/fonts/TrendSans-One-webfont.eot and /dev/null differ diff --git a/public/fonts/TrendSans-One-webfont.svg b/public/fonts/TrendSans-One-webfont.svg deleted file mode 100755 index f3cd8df53..000000000 --- a/public/fonts/TrendSans-One-webfont.svg +++ /dev/null @@ -1,2059 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/public/fonts/TrendSans-One-webfont.ttf b/public/fonts/TrendSans-One-webfont.ttf deleted file mode 100755 index 532bcbb4e..000000000 Binary files a/public/fonts/TrendSans-One-webfont.ttf and /dev/null differ diff --git a/public/fonts/TrendSans-One-webfont.woff b/public/fonts/TrendSans-One-webfont.woff deleted file mode 100755 index bbf534d99..000000000 Binary files a/public/fonts/TrendSans-One-webfont.woff and /dev/null differ diff --git a/server.js b/server.js index 53554c437..e683a3b99 100755 --- a/server.js +++ b/server.js @@ -65,6 +65,17 @@ app.use(robots(__dirname + '/robots.txt')) // Routes require('./app/routes')(app); // pass our application into our routes +/** + * Lambda Set-Up + * - Upload all Lambda functions on server start so they are ready to be called + */ +// var lambdaws = require('./app/other/aws_services').lambdaws; + +// var lambda_functions_path = __dirname + '/app/lambda'; +// fs.readdirSync(lambda_functions_path).forEach(function(file) { +// var func = lambdaws.create(require(lambda_functions_path + '/' + file)); +// }); + // Start Application app.listen(port); console.log('****** Servant Boilerplate ' + env + ' is now running on port ' + port + ' ******'); // shoutout to the user