Skip to content

mikermcneil/sails-jsdom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

image_squidhome@2x.png

JSDom Adapter

This adapter provides an interface to JSDom through the ORM (https://github.com/tmpvar/jsdom)

Installation

Since this isn't released as an npm module, you have to download and put JSDomAdapter.js in your api/adapters directory. If this adapter matures, I'm happy to release on npm.

Usage

Create a Page model hooked up to the jsdom adapter:

module.exports = {
	adapter: 'jsdom'
};

Then you can use it:

Page.find({
	url: 'http://www.findmyhosting.com/web-hamster/'
}).done(function(err, page) {
	
	// Page object contains some useful stuff
	console.log(page);

	// Most relevantly, you can access the window object
	console.log(page.window);
});

About Sails.js and Waterline

http://SailsJs.com

Waterline is a new kind of storage and retrieval engine for Sails.js. It provides a uniform API for accessing stuff from different kinds of databases, protocols, and 3rd party APIs. That means you write the same code to get users, whether they live in mySQL, LDAP, MongoDB, or Facebook.

About

Sails adapter for JSDom

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published