Just a test and a note to self.
wget http://www2.census.gov/geo/tiger/GENZ2015/kml/cb_2015_us_county_500k.zip
unzip cb_2015_us_county_500k.zip
{ | |
"name": "streamingtest", | |
"version": "0.0.1", | |
"engines": { | |
"node": ">=0.6.0" | |
}, | |
"dependencies": { | |
"express": "2.5.x", | |
"coffee-script": "1.2.x" | |
}, |
global | |
daemon | |
maxconn 4096 | |
user haproxy | |
group haproxy | |
defaults | |
log global | |
frontend http-in |
doctype html5 | |
html | |
head | |
title Test Page | |
body | |
.error #{message} | |
form(action='/login' method='POST') | |
label Email | |
input(type='email' name='email') |
// | |
// Implementation using express-jwt middle | |
// | |
var express = require('express'), | |
ejwt = require('express-jwt'), | |
jwt = require('jsonwebtoken'), | |
passport = require('passport'), | |
bodyParser = require('body-parser'), | |
LocalStrategy = require('passport-local').Strategy, | |
BearerStrategy = require('passport-http-bearer').Strategy; |
{Binary} = require 'mongodb' | |
# Put together following https://github.com/mongodb/mongo-csharp-driver/blob/master/uuidhelpers.js | |
module.exports.toJUUID = toJUUID = (binId) -> | |
return "" unless binId?.buffer? | |
hex = binId.buffer.toString 'hex' | |
msb = hex.substr(0, 16) | |
lsb = hex.substr(16, 16) | |
msb = msb.substr(14, 2) + msb.substr(12, 2) + msb.substr(10, 2) + msb.substr(8, 2) + msb.substr(6, 2) + msb.substr(4, 2) + msb.substr(2, 2) + msb.substr(0, 2) | |
lsb = lsb.substr(14, 2) + lsb.substr(12, 2) + lsb.substr(10, 2) + lsb.substr(8, 2) + lsb.substr(6, 2) + lsb.substr(4, 2) + lsb.substr(2, 2) + lsb.substr(0, 2) |
# Convert binary encoded object SID to a string | |
# (eg. S-1-5-21-1004336348-1177238915-682003330-512) | |
# | |
# SID format: https://technet.microsoft.com/en-us/library/cc962011.aspx | |
# | |
# ldapjs `searchEntry` has attribute `raw` that holds the raw | |
# values, including the `objectSid` buffer when one exists. Pass that | |
# buffer to get the string representation that can then be easily | |
# used in LDAP search filters, for example. | |
# |
var express = require('express'), | |
bodyParser = require('body-parser'), | |
passport = require('passport'), | |
LocalStrategy = require('passport-local').Strategy; | |
var app = express(); | |
passport.use(new LocalStrategy(function (username, password, cb) { | |
cb(null, false, {message: 'This can never succeed'}); | |
})); |
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src='http://localhost:3000/socket.io/socket.io.js'></script> | |
<script> | |
var socket = io.connect('http://localhost:3000/nsa'); | |
socket.emit('request', { | |
msg : 'appA user is requesting something' | |
}); | |
socket.on('incoming-request', function(data) { |
var chai = require('chai'), | |
should = chai.should(), | |
expect = chai.expect(), | |
assert = chai.assert, | |
supertest = require('supertest-as-promised'), | |
api = supertest('http://localhost:3000'); | |
describe('Pictures', function () { | |
it('should add a picture', function (done) { | |
api.post('/api/v1/pictures') |