Skip to content

Latest commit

 

History

History
78 lines (75 loc) · 1.5 KB

File metadata and controls

78 lines (75 loc) · 1.5 KB

Node Sequelize API

This is the api for the Rivers State app.

Technologies

  1. Nodejs
  2. MySQL
  3. Express
  4. Sequelize

Setup

Install all dependencies
npm install

Create a new .env file

Set your node env variable (development, testing or production) in the .env
NODE_ENV=development

Set your database config for your development environment in the config.js file
The Path to config file = ./src/config/db/config.js

Update the db config in the development object to connect to your local db
"username": "Database User"
"password": "Database Password if any"
"database": "Database Name"
"host": "Database Local Host

Setup MySQL database by configuring the .env file
DB=Database Name
DB_USER=Database User
DB_PASSWORD=Database Password if Any
DB_PORT=3306
DB_HOST=127.0.0.1
PORT=Set Port for API to run on

Run migrations using sequelize
npx sequelize-cli db:migrate

Run seeder to add default admin
npx sequelize-cli db:seed:all

Testing

To run test
npm run test