Skip to content

Instantly share code, notes, and snippets.

View oauth2-restify.js
"use strict";
var restify = require("restify");
var users = require("./users");
// The users module will have a getAuthorizationFromAccessTokenAsync promise-returning export. (Convert to callbacks if you wish).
// It rejects in cause of not authorized, or fulfills with a { scope, customerId } object if the user is authorized.
// The scope property indicates which scopes the user corresponding to a given access token has.
module.exports = function authPlugin(serverRequest, serverResponse, next) {
@aih
aih / parseAndModifyHtml.js
Created May 8, 2011 — forked from clarkdave/parseAndModifyHtml.js
Using node.js to parse HTML with jsdom and modify it with jQuery
View parseAndModifyHtml.js
/**
* npm install jsdom
* npm install jquery
*/
var html = "<!doctype html><html><body><h1>Hello world!</h1></body></html>";
/* parse the html and create a dom window */
var window = require('jsdom').jsdom(html, null, {
// standard options: disable loading other assets