When building the back-end for a web application there are many forces to consider. Different approaches offer varying amounts of speed, usability and flexibility for the application.
Here at Digital Noir we use WordPress to build our websites. WordPress offers many tools to quickly put together a custom website with a lot of flexibility. One thing many people don’t know about WordPress is that it can be used as the back-end for an application such as an iOS mobile App.
While strange at first, it makes sense when you think about how WordPress is built. WordPress can be thought of in two parts: the front-end which is what the users see when viewing the website, and the back-end: a database for storing information. The back-end is what we’re interested in here.
This system is known as a Headless CMS: a back-end content repository accessible via some RESTful API. This idea makes a lot more sense if you simply consider WordPress as a database of information to be used by a front-end system.
To put this all together you’ll need a couple of tools. Firstly you’ll want a way to store custom post information. ACF is a great way to setup custom information based on post type or user. It is also easily accessible through API calls.
Next we need to start testing responses. The best tool for the job is Postman. Postman can be used to send POST queries to a URL and return the JSON response in a meaningful way.
We’ll need to build out our API responses. Luckily, WordPress has a built-in Rest API. These responses can be controlled and customized by through WordPress hooks.
Authentication can be built through customised snippets, but plugins such as WP OAuth Server build this functionality in for you. Other plugins can be found here.
Using these tools you can put together a powerful Headless CMS that offers a lot of flexibility.
If you would like to chat about WordPress websites, give us a call. We’re always happy to talk!