Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

wpcom-proxy-request

Package Overview
Dependencies
Maintainers
52
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wpcom-proxy-request

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

  • 7.0.5
  • Source
  • npm
  • Socket score

Version published
Maintainers
52
Created
Source

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

Keywords

FAQs

Package last updated on 18 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc