node-wpapi
node-wpapi copied to clipboard
Custom Routes Issue, stuck, dynamic properties
Ive been working on this for a while now but just cannot get it to to work:
In my plugin I have a route:
register_rest_route( 'my-plugin/v1', '/(?P<requestType>\w+)/(?P<requestId>\d+)', [ settings ]);
In my node app I have:
var site = new WPAPI({
auth: true,
endpoint: 'http://domain.com/wp-json',
username: 'username',
password: 'pass',
});
site.myRoute = site.registerRoute(
'my-plugin/v1',
'/(?P<requestType>\\w+)/(?P<requestId>\\d+)'
);
site.myRoute().requestType('User').requestId(5).get();
Using "wpapi": "^1.2.1"
Any idea what I am doing wrong?