Oct 16 2010
- 04/10/2011 - Updated application.js and application.rb thanks to @rebo's comments
In this article, I will walk through some simple steps to get a [demo app][2] up and running with [Backbone.js][3] and [Sinatra][4] on [Heroku][5].
| /* The API controller | |
| Exports 3 methods: | |
| * post - Creates a new thread | |
| * list - Returns a list of threads | |
| * show - Displays a thread and its posts | |
| */ | |
| var Thread = require('../models/thread.js'); | |
| var Post = require('../models/post.js'); |
| /**********************************************/ | |
| /* | |
| /* Tomorrow Skin by Ben Truyman - 2011 | |
| /* | |
| /* Based on Chris Kempson's Tomorrow Theme: | |
| /* https://github.com/ChrisKempson/Tomorrow-Theme | |
| /* | |
| /* Inspired by Darcy Clarke's blog post: | |
| /* http://darcyclarke.me/design/skin-your-chrome-inspector/ | |
| /* |
| var application_root = __dirname, | |
| express = require("express"), | |
| path = require("path"), | |
| mongoose = require('mongoose'); | |
| var app = express.createServer(); | |
| // database | |
| mongoose.connect('mongodb://localhost/ecomm_database'); |
| //addEventListener polyfill 1.0 / Eirik Backer / MIT Licence | |
| (function(win, doc){ | |
| if(win.addEventListener)return; //No need to polyfill | |
| function docHijack(p){var old = doc[p];doc[p] = function(v){return addListen(old(v))}} | |
| function addEvent(on, fn, self){ | |
| return (self = this).attachEvent('on' + on, function(e){ | |
| var e = e || win.event; | |
| e.preventDefault = e.preventDefault || function(){e.returnValue = false} | |
| e.stopPropagation = e.stopPropagation || function(){e.cancelBubble = true} |
| // --------------------------------------------------------------------------------- | |
| // CSS Image Paths | |
| // --------------------------------------------------------------------------------- | |
| $bg-img-path: '/path/to/images/'; // Base Path for BG Layout Images |
| # Must be run on an Amazon Linux AMI that matches AWS Lambda's runtime | |
| # As of Dec 6, 2018, this is Amazon Linux AMI – amzn-ami-hvm-2017.03.1.20170812-x86_64-gp2 | |
| # Check latest from here: https://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html | |
| # SSH to Amazon Linux AMI instance, that you just created: | |
| ssh -i ${EC2_KEY} ${EC2_USERNAME}@${EC2_IP} | |
| sudo yum -y install libpng-devel libjpeg-devel libtiff-devel gcc | |
| # GraphicsMagick download latest stable as of Dec 6, 2018, this is 1.3.31 (latest stable) | |
| curl -O https://sourceforge.net/projects/graphicsmagick/files/graphicsmagick/1.3.31/GraphicsMagick-1.3.31.tar.gz |
brew install minikube
brew install hyperkit
minikube config set driver hyperkit
minikube start --memory 8192 --cpus 5 --disk-size=80GB
brew install docker
# point docker to the minikube env
eval $(minikube -p minikube docker-env)
# validate setup