- Run
sudo mysql
- Run
CREATE DATABASE confusion;
- Run
SET GLOBAL validate_password.policy=LOW;
- Run
CREATE USER 'confuseduser'@'localhost' IDENTIFIED BY 'enigma123!';
- Run
GRANT ALL ON confusion.* TO 'confuseduser'@'localhost' WITH GRANT OPTION;
- Run
FLUSH PRIVILEGES;
- Run
exit
- Run
sudo mysql -u confuseduser -p confusion
- Run
npm install
- Run
npx sequelize db:migrate
- Run
npx sequelize db:seed:all
- In the terminal, type
cp .env.example .env
- In the terminal, type
node
to open Node REPL - Use
require('crypto').randomBytes(64).toString('hex')
2 times to get the values for the following constantsACCESS_TOKEN_SECRET
REFRESH_TOKEN_SECRET
- Enter the text above in the .env file
- Provide the gmail account credentials in the .env file which will be used to send emails to the admin users of this application.
- Run
cd bin
- Run
openssl genrsa 1024 > private.key
- Run
openssl req -new -key private.key -out cert.csr
- Run
openssl x509 -req -in cert.csr -signkey private.key -out certificate.pem
- Run
npm start
- Open Postman and send the following request (body option raw JSON):
POST https://localhost:3443/users/signup
{
"username": "confuseduser",
"password": "password"
}
- Open mysql REPL in the terminal and execute the following query on the
confusion
schema:UPDATE Users SET admin = 1;
- Pull code from the repository https://github.com/khuramzahid/conFusion-Angular6 in a convenient directory
- Run
npm start
Jogesh Muppala https://github.com/jmuppala/
- To initialize Sequelize if already not done, type
sequelize init
in the terminal - Sample command to generate a new migration file
sequelize model:generate --name User --attributes firstName:string,lastName:string,email:string
- Sample command to generate a new seeder file
sequelize seed:generate --name demo-user