Nuxt headless using WordPress REST API
The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:
Nuxt + WordPress REST API boilerplate
[ 1.2.0 ]
[ 1.1.0 ]
Please note this is a boilerplate, it contains some defaults you might want to pay attention to: - CORS - You should set this to work only on your website url when in production or staging, work locally on your machine for dev. - Plugins and Theme, most of these can be removed, but you'll need ACF (free version is OK) to make it work.
Copy the contents of the /wordpress folder in your wordpress installation (make sure to edit wp-config.php)
Make sure you activate all the plugins and set Moustache Design as your active theme in wordpress (you can rename it if you want)
Set permalinks in wordpress to anything but the default (I suggest
Make sure you set your CORS correctly to point to your website when in production/staging
Make sure assets/config.js reflects your configuration and endpoints for the WP rest api and wordpress url
You can edit all the files and config freely. This is MIT licensed, but credit is welcome.
Check how I used this in my blog at https://medium.com/@moustachedesign/creating-a-website-with-nuxt-js-and-wordpress-rest-api-51cf66599cf3
The current config allows to either initialise the api calls in
nuxtServerInit, or commit
fetchmutations from each page. You can otherwise skip Vuex and load the data for each page using
# install dependencies $ yarn # Or npm install
serve with hot reload at localhost:3000
service worker is disabled in dev
$ yarn dev # or npm run dev
build for production and launch server
$ yarn build # or npm run build $ yarn start # or npm start
generate static project
$ yarn generate # or npm run generate
I suggest now for SSR websites using nodeJS, or Netlify for static sites (free hosting) using
You can of course use this as middleware following Nuxt Docs below.
For detailed explanation on how things work with Nuxt, checkout the Nuxt.js docs.
All PRs are very welcome and much needed. Steps to contribute: - Fork development branch - Make your changes - Make a PR - PR is either approved or sent back - If PR is approved I'll include it in the next release