/notebook_server

API for notebook app using express.js

Primary LanguageTypeScriptMIT LicenseMIT

Database

Need to use postgres database


Run all migrations:

npx sequelize-cli db:migrate --env development --config "src/config/db_config.json" --migrations-path "src/migrations" --models-path "src/models"


Run one migration:

npx sequelize-cli db:migrate --name file_name.js --env development --config "src/config/db_config.json" --migrations-path "src/migrations" --models-path "src/models"

npx sequelize-cli db:migrate --name 20221101081043-create-users.js --env development --config "src/config/db_config.json" --migrations-path "src/migrations" --models-path "src/models"

npx sequelize-cli db:migrate --name create-folders.js --env development --config "src/config/db_config.json" --migrations-path "src/migrations" --models-path "src/models"

npx sequelize-cli db:migrate --name 20221101081613-create-notes.js --env development --config "src/config/db_config.json" --migrations-path "src/migrations" --models-path "src/models"

npx sequelize-cli db:migrate --name 20221121074107-create-reset-password-code.js --env development --config "src/config/db_config.json" --migrations-path "src/migrations" --models-path "src/models"


Revert one migraion:

npx sequelize-cli db:migrate:undo --name file_name.js --env development --config "src/config/db_config.json" --migrations-path "src/migrations" npx sequelize-cli db:migrate:undo --name 20221101081613-create-notes.js --env development --config "src/config/db_config.json" --migrations-path "src/migrations"



Create .env file

Example .env file:

PORT=8000
ENVIRONMENT=development # development or production
JWT_SECRET=ANY STRING
MAILER=email to send verification code to user
MAILER_PASSWORD=app specific password of the email


Run development server:

npm run dev