Skip to content

Latest commit

 

History

History
38 lines (29 loc) · 1.49 KB

README.md

File metadata and controls

38 lines (29 loc) · 1.49 KB

Node-with-WordPress-REST-API

A basic example of a Node.js app using WordPress / WP REST API endpoints for the data source. Matt Mullenweg referred to this as a "reverse mullet" at WordCampUS 2015. Party up front. Business out back.

Requirements

  • WordPress (minimum v4.4) running the WP REST API v2 plugin
  • Node.js. The following modules are required:
    • Express - Application framework
    • Jade - Node template language
    • Path - utilities for handling and transforming file paths
    • HTTP

Getting up and running

  • Download or clone this repository
  • Navigate to the repository directory in the terminal
  • Run npm install
  • Create a config file with the following command: touch config.js
  • Modify the following sample to meet your needs and add it to your config.js file:
var config = {};

//Be sure to omit the protocol (in this case 'http') from wpURL value
config.wpUrl = 'www.example.com';
config.listen = 3000;

module.exports = config;

Example Routes

Returns all public posts on a WordPress site.

Returns a single public WordPress post