-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Esther Jun Kim
committed
Feb 15, 2014
0 parents
commit 02a3094
Showing
20 changed files
with
368 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"directory": "public/bower_components" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.vagrant | ||
node_modules/ | ||
public/bower_components/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# multi-screen-demo | ||
|
||
Multi-screen WebSocket demo |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
|
||
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | ||
VAGRANTFILE_API_VERSION = "2" | ||
|
||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | ||
# All Vagrant configuration is done here. The most common configuration | ||
# options are documented and commented below. For a complete reference, | ||
# please see the online documentation at vagrantup.com. | ||
|
||
# Every Vagrant virtual environment requires a box to build off of. | ||
config.vm.box = "precise64" | ||
|
||
# The url from where the 'config.vm.box' box will be fetched if it | ||
# doesn't already exist on the user's system. | ||
config.vm.box_url = "http://files.vagrantup.com/precise64.box" | ||
|
||
# Provision VM with the specified shell script | ||
config.vm.provision :shell, :path => "provision.sh" | ||
|
||
# Create a forwarded port mapping which allows access to a specific port | ||
# within the machine from a port on the host machine. In the example below, | ||
# accessing "localhost:8080" will access port 80 on the guest machine. | ||
config.vm.network :forwarded_port, guest: 3000, host: 3000 | ||
|
||
# Create a private network, which allows host-only access to the machine | ||
# using a specific IP. | ||
# config.vm.network :private_network, ip: "192.168.33.10" | ||
|
||
# Create a public network, which generally matched to bridged network. | ||
# Bridged networks make the machine appear as another physical device on | ||
# your network. | ||
# config.vm.network :public_network | ||
|
||
# If true, then any SSH connections made will enable agent forwarding. | ||
# Default value: false | ||
# config.ssh.forward_agent = true | ||
|
||
# Share an additional folder to the guest VM. The first argument is | ||
# the path on the host to the actual folder. The second argument is | ||
# the path on the guest to mount the folder. And the optional third | ||
# argument is a set of non-required options. | ||
# config.vm.synced_folder "../data", "/vagrant_data" | ||
|
||
# Provider-specific configuration so you can fine-tune various | ||
# backing providers for Vagrant. These expose provider-specific options. | ||
# Example for VirtualBox: | ||
# | ||
# config.vm.provider :virtualbox do |vb| | ||
# # Don't boot with headless mode | ||
# vb.gui = true | ||
# | ||
# # Use VBoxManage to customize the VM. For example to change memory: | ||
# vb.customize ["modifyvm", :id, "--memory", "1024"] | ||
# end | ||
# | ||
# View the documentation for the provider you're using for more | ||
# information on available options. | ||
|
||
# Enable provisioning with Puppet stand alone. Puppet manifests | ||
# are contained in a directory path relative to this Vagrantfile. | ||
# You will need to create the manifests directory and a manifest in | ||
# the file base.pp in the manifests_path directory. | ||
# | ||
# An example Puppet manifest to provision the message of the day: | ||
# | ||
# # group { "puppet": | ||
# # ensure => "present", | ||
# # } | ||
# # | ||
# # File { owner => 0, group => 0, mode => 0644 } | ||
# # | ||
# # file { '/etc/motd': | ||
# # content => "Welcome to your Vagrant-built virtual machine! | ||
# # Managed by Puppet.\n" | ||
# # } | ||
# | ||
# config.vm.provision :puppet do |puppet| | ||
# puppet.manifests_path = "manifests" | ||
# puppet.manifest_file = "site.pp" | ||
# end | ||
|
||
# Enable provisioning with chef solo, specifying a cookbooks path, roles | ||
# path, and data_bags path (all relative to this Vagrantfile), and adding | ||
# some recipes and/or roles. | ||
# | ||
# config.vm.provision :chef_solo do |chef| | ||
# chef.cookbooks_path = "../my-recipes/cookbooks" | ||
# chef.roles_path = "../my-recipes/roles" | ||
# chef.data_bags_path = "../my-recipes/data_bags" | ||
# chef.add_recipe "mysql" | ||
# chef.add_role "web" | ||
# | ||
# # You may also specify custom JSON attributes: | ||
# chef.json = { :mysql_password => "foo" } | ||
# end | ||
|
||
# Enable provisioning with chef server, specifying the chef server URL, | ||
# and the path to the validation key (relative to this Vagrantfile). | ||
# | ||
# The Opscode Platform uses HTTPS. Substitute your organization for | ||
# ORGNAME in the URL and validation key. | ||
# | ||
# If you have your own Chef Server, use the appropriate URL, which may be | ||
# HTTP instead of HTTPS depending on your configuration. Also change the | ||
# validation key to validation.pem. | ||
# | ||
# config.vm.provision :chef_client do |chef| | ||
# chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME" | ||
# chef.validation_key_path = "ORGNAME-validator.pem" | ||
# end | ||
# | ||
# If you're using the Opscode platform, your validator client is | ||
# ORGNAME-validator, replacing ORGNAME with your organization name. | ||
# | ||
# If you have your own Chef Server, the default validation client name is | ||
# chef-validator, unless you changed the configuration. | ||
# | ||
# chef.validation_client_name = "ORGNAME-validator" | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/** | ||
* Module dependencies. | ||
*/ | ||
|
||
var express = require('express') | ||
, http = require('http') | ||
, path = require('path') | ||
|
||
, routes = require('./routes') | ||
, api = require('./routes/api'); | ||
|
||
var app = express(); | ||
|
||
// all environments | ||
app.set('port', process.env.PORT || 3000); | ||
app.set('views', path.join(__dirname, 'views')); | ||
app.set('view engine', 'jade'); | ||
app.use(express.favicon()); | ||
app.use(express.logger('dev')); | ||
app.use(express.cookieParser()); | ||
app.use(express.bodyParser()); | ||
app.use(express.methodOverride()); | ||
app.use(express.static(path.join(__dirname, 'public'))); | ||
app.use(app.router); | ||
|
||
// development only | ||
if ('development' == app.get('env')) { | ||
app.use(express.errorHandler()); | ||
} | ||
|
||
// serve index and view partials | ||
app.get('/', routes.index); | ||
app.get('/partials/:view', routes.partials); | ||
|
||
// REST API | ||
app.get('/api/user', api.getUser); | ||
|
||
// redirect all others to the index (HTML5 history) | ||
app.get('*', routes.index); | ||
|
||
http.createServer(app).listen(app.get('port'), function(){ | ||
console.log('Express server listening on port ' + app.get('port')); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "multi-screen-demo", | ||
"version": "0.1.0", | ||
"private": true, | ||
"dependencies": { | ||
"angular": "1.2.13", | ||
"angular-resource": "1.2.13", | ||
"angular-route": "1.2.13", | ||
"angular-socket-io": "0.3.0", | ||
"bootstrap": "3.1.1", | ||
"font-awesome": "4.0.3", | ||
"jquery": "2.1.0" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "multi-screen-demo", | ||
"version": "0.1.0", | ||
"private": true, | ||
"scripts": { | ||
"start": "node app.js" | ||
}, | ||
"dependencies": { | ||
"express": "3.4.8", | ||
"jade": "1.1.5", | ||
"mongoose": "3.8.7", | ||
"socket.io": "0.9.16" | ||
}, | ||
"devDependencies": { | ||
"grunt": "0.4.2" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env bash | ||
|
||
# configure apt to install MongoDB | ||
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 | ||
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list | ||
|
||
# install initial packages | ||
apt-get update | ||
apt-get install -y build-essential python-software-properties git mongodb-10gen | ||
|
||
# install the latest version of node.js | ||
add-apt-repository -y ppa:chris-lea/node.js | ||
apt-get update | ||
apt-get install -y nodejs | ||
|
||
# install super helpful node packages | ||
npm install -g bower supervisor grunt-cli |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
body { | ||
padding-top: 20px; | ||
padding-bottom: 20px; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use strict'; | ||
|
||
// Declare app level module which depends on filters, and services | ||
|
||
angular.module('multi-screen-demo', [ | ||
'multi-screen-demo.controllers', | ||
'multi-screen-demo.directives', | ||
'multi-screen-demo.filters', | ||
'multi-screen-demo.services', | ||
|
||
'ngRoute' | ||
]). | ||
config(function ($routeProvider, $locationProvider) { | ||
$routeProvider. | ||
when('/', { | ||
templateUrl: '/partials/home' | ||
}). | ||
when('/about', { | ||
templateUrl: '/partials/about' | ||
}). | ||
otherwise({ | ||
redirectTo: '/' | ||
}); | ||
|
||
$locationProvider.html5Mode(true); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use strict'; | ||
|
||
/* Admin controllers */ | ||
|
||
angular.module('multi-screen-demo.controllers', [ | ||
]). | ||
// sample controller for the home page | ||
controller('HomeCtrl', function($scope, User) { | ||
$scope.user = User.query(); | ||
}). | ||
|
||
// sample controller for the about page | ||
controller('AboutCtrl', function($scope) { | ||
$scope.description = 'MEAN is a full stack JavaScript environment for developing web applications'; | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
'use strict'; | ||
|
||
/* Directives */ | ||
|
||
angular.module('multi-screen-demo.directives', [ | ||
]). | ||
// create your own directive here | ||
directive('yourDirectiveName', function () { | ||
return function () { | ||
return; | ||
}; | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
'use strict'; | ||
|
||
/* Filters */ | ||
|
||
angular.module('multi-screen-demo.filters', [ | ||
]). | ||
// create your own filter here | ||
filter('yourFilterName', function () { | ||
return function () { | ||
return; | ||
}; | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
'use strict'; | ||
|
||
/* Services */ | ||
|
||
angular.module('multi-screen-demo.services', [ | ||
'ngResource' | ||
]). | ||
// resource for querying users | ||
factory('User', ['$resource', | ||
function($resource) { | ||
return $resource('/api/user', {}, { | ||
query: { method: 'GET', isArray: false } | ||
}); | ||
}]); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* REST API | ||
*/ | ||
|
||
// get user | ||
exports.getUser = function(req, res) { | ||
res.json({ | ||
userId: 'EstherKim', | ||
firstname: 'Esther', | ||
lastname: 'Kim' | ||
}); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* GET index and view partials | ||
*/ | ||
|
||
exports.index = function(req, res) { | ||
res.render('index'); | ||
}; | ||
|
||
exports.partials = function (req, res) { | ||
var view = req.params.view; | ||
res.render('partials/' + view); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
doctype html | ||
html(ng-app='multi-screen-demo') | ||
head | ||
title multi-screen-demo | ||
meta(name='viewport', content='width=device-width, initial-scale=1.0, user-scalable=no') | ||
link(rel='stylesheet', type='text/css', href='/bower_components/bootstrap/dist/css/bootstrap.min.css') | ||
link(rel='stylesheet', type='text/css', href='/bower_components/font-awesome/css/font-awesome.min.css') | ||
link(rel='stylesheet', href='/css/style.css') | ||
body | ||
div.container(ng-view) | ||
|
||
script(type='text/javascript', src='/bower_components/angular/angular.min.js') | ||
script(type='text/javascript', src='/bower_components/angular-resource/angular-resource.min.js') | ||
script(type='text/javascript', src='/bower_components/angular-route/angular-route.min.js') | ||
script(type='text/javascript', src='/bower_components/jquery/dist/jquery.min.js') | ||
script(type='text/javascript', src='/bower_components/bootstrap/dist/js/bootstrap.min.js') | ||
script(type='text/javascript', src='/js/app.js') | ||
script(type='text/javascript', src='/js/controllers.js') | ||
script(type='text/javascript', src='/js/directives.js') | ||
script(type='text/javascript', src='/js/filters.js') | ||
script(type='text/javascript', src='/js/services.js') |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
include navbar | ||
|
||
div(ng-controller='AboutCtrl') | ||
h1 About MEAN | ||
p {{ description }} | ||
ul | ||
li <b>M</b>ongoDB | ||
li <b>E</b>xpress | ||
li <b>A</b>ngularJS | ||
li <b>N</b>ode |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
include navbar | ||
|
||
div(ng-controller='HomeCtrl') | ||
h1 Hello, {{ user.firstname }} {{ user.lastname }} |
Oops, something went wrong.