As you may recall from Chapter 9, Adding a Server-Side Database, CRUD stands for create, read, update, and delete. In that chapter, we used MongoDB to create CRUD operations. In this section, we will use MySQL to create backend authentication. We will use MySQL with PHP in the PHP app we have just created with PSRs. So, let's start by creating the table that we will need in the MySQL database.
Creating MySQL tables
Make sure you have installed MySQL Server on your local machine and created a database called nuxt-php. Once you've done that, follow these steps to finish up the first part of our API:
- Insert the following SQL query to create the table in the database:
CREATE TABLE user (
uuid varchar(255) NOT NULL,
name varchar(255) NOT NULL,
slug varchar(255) NOT NULL,
created_on int(10) unsigned NOT NULL,
updated_on int(10) unsigned NOT NULL,
UNIQUE KEY slug (slug)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
The first thing...