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.
- WordPress (minimum v4.4) running the WP REST API v2 plugin
- Node.js. The following modules are required:
- 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;
- Run the app with the following command:
node index.js
- Visit http://localhost:3000
Returns all public posts on a WordPress site.
Returns a single public WordPress post