node-squarespace-middleware
Interface with a Squarespace site using a node.js application.
Installation
npm install node-squarespace-middleware
Updating
npm update node-squarespace-middleware
Usage
Configuration
// Get the middleware modulevar nsm = ;var sqsMiddleware = ; // Set config valuessqsMiddleware;sqsMiddleware;sqsMiddleware; // If you have a sitewide password enabledsqsMiddleware; // If you are using a site in sandbox trial modesqsMiddleware; // If you dont need to pre-fetch full collection data...sqsMiddleware;
Authentication
// Perform the auth loginsqsMiddleware;
Request Interface
// Perform a squarespace:querysqsMiddleware; // Get json for a page// Pass null for {qrs} hash if not passing query stringsqsMiddleware; // Get html for a page// Pass null for {qrs} hash if not passing query stringsqsMiddleware; // Get html AND json for a page// Pass null for {qrs} hash if not passing query stringsqsMiddleware; // Get API data for collections and siteLayoutsqsMiddleware; // Get a block rendered through LayoutEngine// This is a complicated process and is primarily in place to support the node-squarespace-server// But for example, this is how you would render the first block for a given block idsqsMiddleware; // Retrieve the logged in crumbsqsMiddleware;
Methods
Configuration
- get( key )
- set( key, val )
Authentication
- doLogin( callback )
Request Interface
- getQuery( data, qrs, callback )
- getJson( url, qrs, callback )
- getHtml( url, qrs, callback )
- getJsonAndHtml( url, qrs, callback )
- getAPIData( callback )
- getAPICollection( collectionId, callback )
- getBlockJson( blockId, callback )
- getWidgetHtml( blockJSON, callback )
- getCrumb()
Pull Requests
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request