7.0.5 • Published 7 months ago

wpcom-proxy-request v7.0.5

Weekly downloads
156
License
MIT
Repository
github
Last release
7 months ago

wpcom-proxy-request

Proxied cookie-authenticated REST-API and WP-API requests to WordPress.com

You likely want to use the high-level APIs in wpcom.js instead of using this module directly.

This module offers access to the WordPress.com REST-API and WP-API via a proxying <iframe> pointing to a special URL that proxies API requests on the host page's behalf.

It is intended to be used in the browser (client-side) via a bundler like browserify or webpack.

Installation

Install wpcom-proxy-request using npm:

npm install wpcom-proxy-request

Example

// Import wpcom-proxy-request handler
import proxy from 'wpcom-proxy-request';

proxy( { path: '/me' }, function ( err, body, headers ) {
	if ( err ) {
		throw err;
	}

	const div = document.createElement( 'div' );
	div.innerHTML = 'Your WordPress.com "username" is: <b>@' + res.username + '</b>';
	document.body.appendChild( div );
} );

Running tests

Compile and watch client-test application

make watch-test-app

Run server

make run-test-app

Open a tab pointing to http://calypso.localhost:3001/

License

MIT – Copyright Automattic 2014

7.0.5

7 months ago

7.0.0

11 months ago

7.0.4

7 months ago

7.0.3

11 months ago

7.0.2

11 months ago

7.0.1

11 months ago

6.0.0

3 years ago

5.0.2

6 years ago

5.0.1

6 years ago

5.0.0

6 years ago

4.0.6

6 years ago

4.0.5

7 years ago

4.0.4

7 years ago

4.0.3

7 years ago

4.0.2

7 years ago

4.0.1

7 years ago

4.0.0-alpha.1

7 years ago

3.1.0

8 years ago

3.0.0

8 years ago

3.0.0-beta.3

8 years ago

3.0.0-beta.2

8 years ago

3.0.0-beta.1

8 years ago

3.0.0-beta.0

8 years ago

2.0.0

8 years ago

1.2.0

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.5

8 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.2.5

10 years ago

0.2.4

10 years ago

0.2.3

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago