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 you will have noticed is that we are using uuid instead of id like we did in Chapter 12, Creating User Logins and API Authentication. UUID stands for Universally Unique Identifier. There may be reasons why and benefits that will make you want to choose UUIDs over auto increment keys for indexing records in database tables. For example, you can create a UUID without connecting to the database. It is practically unique across apps, so you...