We will mostly use the same code that we created for the MySQL recipe and add a security layer to validate our access tokens:
- The first thing we need to do is to modify our config file (config/index.js), add a security node with the secretKey we are going to use to create our tokens, and add the expiration time of the token:
export default { db: { dialect: 'mysql', // The database engine you want to use host: 'localhost', // Your host, by default is localhost database: 'blog', // Your database name user: 'root', // Your MySQL user, by default is root password: '123456' // Your MySQL password }, security: { secretKey: 'C0d3j0bs', // Secret key expiresIn: '1h' // Expiration can be: 30s, 30m, 1h, 7d, etc. } };