1
使用express可以从Wordpress API制作外部http获取请求吗?使用Express和NODEJS的Wordpress API
假设我想向http://demo.wp-api.org/wp-json/wp/v2/posts发送获取请求 - 这是来自wordpress的帖子列表。
样品:
router.get('/posts', function(req, res){
I should make an external http get request here from wordpress api
("http://demo.wp-api.org/wp-json/wp/v2/posts")
Then I want to display the response as json
}
当然。使用'request'模块:https://www.npmjs.com/package/request –
谢谢。它已经在工作了。我会进行更新。 –