Git Product home page Git Product logo

confusion-node-backend's Introduction

ConFusion Node Backend

Create Database

  1. Run sudo mysql
  2. Run CREATE DATABASE confusion;
  3. Run SET GLOBAL validate_password.policy=LOW;
  4. Run CREATE USER 'confuseduser'@'localhost' IDENTIFIED BY 'enigma123!';
  5. Run GRANT ALL ON confusion.* TO 'confuseduser'@'localhost' WITH GRANT OPTION;
  6. Run FLUSH PRIVILEGES;
  7. Run exit
  8. Run sudo mysql -u confuseduser -p confusion

Application Setup (Uses Node v12)

  1. Run npm install
  2. Run npx sequelize db:migrate
  3. Run npx sequelize db:seed:all
  4. In the terminal, type cp .env.example .env
  5. In the terminal, type node to open Node REPL
  6. Use require('crypto').randomBytes(64).toString('hex') 2 times to get the values for the following constants ACCESS_TOKEN_SECRET
    REFRESH_TOKEN_SECRET
  7. Enter the text above in the .env file
  8. Provide the gmail account credentials in the .env file which will be used to send emails to the admin users of this application.
  9. Run cd bin
  10. Run openssl genrsa 1024 > private.key
  11. Run openssl req -new -key private.key -out cert.csr
  12. Run openssl x509 -req -in cert.csr -signkey private.key -out certificate.pem
  13. Run npm start
  14. Open Postman and send the following request (body option raw JSON):
        POST https://localhost:3443/users/signup
        {
            "username": "confuseduser",
            "password": "password"
        }
  1. Open mysql REPL in the terminal and execute the following query on the confusion schema: UPDATE Users SET admin = 1;
  2. Pull code from the repository https://github.com/khuramzahid/conFusion-Angular6 in a convenient directory
  3. Run npm start

Acknowledgement

Jogesh Muppala https://github.com/jmuppala/

Sequelize Help

  1. To initialize Sequelize if already not done, type sequelize init in the terminal
  2. Sample command to generate a new migration file sequelize model:generate --name User --attributes firstName:string,lastName:string,email:string
  3. Sample command to generate a new seeder file sequelize seed:generate --name demo-user

confusion-node-backend's People

Contributors

khuramzahid avatar khurramzahid avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.