Installation
node-wpapi
works both on the server or in the browser. Node.js version 4.0 or higher is required.
Install with NPM
To use the library from Node, install it with npm:
npm install --save wpapi
Then, within your application’s script files, require
the module to gain access to it:
var WPAPI = require( 'wpapi' );
This library is designed to work in the browser as well, via a build system such as Browserify or Webpack; just install the package and require( 'wpapi' )
from your application code.
Download the UMD Bundle
Alternatively, you may download a ZIP archive of the bundled library code. These files are UMD modules, which may be included directly on a page using a regular <script>
tag or required via AMD or CommonJS module systems. In the absence of a module system, the UMD modules will export the browser global variable WPAPI
, which can be used in place of require( 'wpapi' )
to access the library from your code.