I got this error The requested URL /wp/v2/posts was not found on this server.
when trying to post a new post using WP api in node.js.
var WPAPI = require('wpapi')
var wp = new WPAPI({
endpoint: 'http://example.com',
username: 'test',
password: 'test'
})
wp.posts()
.create({
title: 'Your Post Title',
content: 'Your post content',
status: 'publish'
})
.then(function(response) {
console.log(response.id)
})
.catch(function(err) {
console.log(err)
})
The code is taken from here https://github.com/WP-API/node-wpapi
What's the possible causes of the issue? I'd tried to change the permalink to postname.