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 http = require('http') | |
var server = http.createServer(function(req, res) { | |
res.writeHead(200, {"Content-Type": "text/plain"}); | |
res.write("hello \n") | |
setTimeout(function() { | |
res.end("world \n") | |
}, 2000); | |
}); |
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 r_login = require('./login'); | |
var r_posts = require('./posts'); | |
var r_errors = require('./errors'); | |
var expressWinston = require('express-winston'); | |
var winston = require('winston'); | |
module.exports = function(app) { | |
//express-winston logger makes sense BEFORE the router. |
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 winston = require('winston'); | |
var logger = new (winston.Logger)({ | |
transports: [ | |
new (winston.transports.Console)({ json: false, timestamp: true }), | |
new winston.transports.File({ filename: __dirname + '/debug.log', json: false }) | |
], | |
exceptionHandlers: [ | |
new (winston.transports.Console)({ json: false, timestamp: true }), | |
new winston.transports.File({ filename: __dirname + '/uncaught_exceptions.log', json: 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
var bunyan = require('bunyan'); | |
var config = require('./config'); | |
var logSettings = config.logSettings; | |
var log = bunyan.createLogger({ | |
name: config.app_name, | |
src: true, | |
streams : [ | |
{ | |
stream : process.stdout, |
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
# -*- 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| | |
config.vm.box = "centos_6.4" | |
config.vm.box_url = "http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130731.box" |
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
### /etc/hosts #### | |
# Add to hosts. 192.168.0.13 is your server ip (ifconfig) | |
192.168.0.13 www.site2.com site2.com | |
192.168.0.13 www.site3.com site3.com |
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
### host file under sites-available ### | |
# The upstream module is the link between Node.js and Nginx. | |
# Upstream is used for proxying requests to other servers. | |
# All requests for / get distributed between any of the servers listed. | |
upstream app_nodeapp1 { | |
# Set up multiple Node.js webservers for Load balancing. | |
# max_fails refers to number of failed attempts |
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
#created by @nthgergo | |
set :application, "APPLICATION_NAME" | |
set :scm, :git | |
set :repository, "GIT_URL" | |
set :user, "ec2-user" | |
set :ssh_options, { :forward_agent => true } | |
default_run_options[:pty] = true | |
set :use_sudo, false | |
set :branch, "master" |
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
<form method="post" action="/posts"> | |
<input type="hidden" name="_method" value="put"> | |
<input type="text" name="title"> | |
<textarea name="content"></textarea> | |
<input type="submit" value="Save"> | |
</form> | |
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
require 'json' | |
require 'pp' | |
require 'base64' | |
require 'octokit' | |
require_relative "./GitHubClient" | |
env = ENV['BACKUP_ENV'] || 'dev' | |
config_file = "../config/#{env}.backup.json" | |
config = JSON.parse(IO.read(config_file))['github']; |
OlderNewer