Skip to content

Instantly share code, notes, and snippets.

View ryanlelek's full-sized avatar
🔮
Like Magic

Ryan Lelek ryanlelek

🔮
Like Magic
View GitHub Profile
'use strict';
// Firstly, please don't use this in production.
// Use nginx forwarding/upstream instead
// Nginx is way more secure and battle-tested
// ################
// ### Method 1 ###
// ################
#!/bin/bash
# http://forums.powervps.com/showthread.php?t=1313
# f = background
ssh -Ngf -L 12345:127.0.0.1:3306 [email protected]
@ryanlelek
ryanlelek / api_nock_text.js
Last active December 31, 2015 03:08
Node.js API Testing with Nock
'use strict';
// Modules
var request = require('request');
var nock = require('nock');
// API You want to use/mock/test
var api_url = 'http://api.example.com';
// You can put this into a separate .json file and just require() it
# First, run your node script with nohup
# (keep the "&" at the end, it puts the process in teh background)
nohup node server/index.js --port 8443 &
# Now we capture the process ID so we know what to kill later
export SERVER_PID=$!;
echo $SERVER_PID;
# Sleep 5 Seconds to allow the server script time to startup
@ryanlelek
ryanlelek / Node SSL
Last active December 28, 2015 18:19
Node.js Express SSL
This Gist will help you configure SSL on a pure Node.js server
(without a server like Apache/nginx, but you should probably use it in production!)