This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//add object to state | |
setProducts([ | |
...products, | |
{ | |
product_id: newproduct.product_id, | |
product_name: newproduct.product_name, | |
}, | |
]); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mysql from "mysql2/promise"; | |
export async function query({ query, values = [] }) { | |
// PlanetScale; | |
const dbconnection = await mysql.createConnection( | |
process.env.MYSQL_DATABASE_URL | |
); | |
//Digital ocean ubuntu | |
// const dbconnection = await mysql.createConnection({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password'; | |
CREATE USER 'username'@'%' IDENTIFIED BY 'password'; | |
GRANT ALL ON *.* TO 'username'@'localhost'; | |
GRANT ALL ON *.* TO 'username'@'%'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Setup NextJS on Ubuntu server (Digital Ocean, EC2,...) Terminal Commands | |
#based on my YouTube video | |
#Recommended: An ubuntu server with at least 2 GB memory to handle npm run build | |
#login to server | |
ssh root@ip_address | |
#Upgrade Server - may take a few minutes | |
sudo apt update | |
sudo apt upgrade |