Security must be managed properly in API, no .env file is to be checked into the code repository. .env.example file will give you guidance on what to use to properly configure an .env file.
- API is developed in a controller model format. Think models will persist information into the database.
- Use migrations/seeders folder to properly manage database changes
- Route all paths through ./config/routes
Database schema is done via Sequelize
npx sequelize-cli model:generate --name market --attributes timeStamp:DATE,epochTime:INTEGER,symbol:STRING,bid:DOUBLE,ask:DOUBLE,bidVolume:DOUBLE,askVolume:DOUBLE,spread:DOUBLE,microLotValue:DOUBLE,miniLotValue:DOUBLE,lotValue:DOUBLE,tradable:BOOLEAN,epochTimeLocal:INTEGER,timeStampLocal:DATE
sequelize-auto -c "config\config.js" -o "models" -h <host> -d <database> -u <user> -x [password] -p [port] --dialect [dialect] -t [tableName]
kubectl create secret generic bigpotato-secret --from-env-file=.env -n crm
kubectl delete secret bigpotato-secret -n crm
Associations must be done manually though each model file
- All required packages are installed
- Sequelize is initiated
sequelize init
- Hapi is configured to work with JWT and Swagger
This script populates 1000 rows in the sql table. Table schema
CREATE TABLE `videos` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`name` VARCHAR(50) NOT NULL COLLATE 'latin1_swedish_ci',
`url` VARCHAR(250) NOT NULL COLLATE 'latin1_swedish_ci',
`thumbnailUrl` VARCHAR(250) NOT NULL COLLATE 'latin1_swedish_ci',
`isPrivate` TINYINT(1) NOT NULL DEFAULT '0',
`timesViewed` INT(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`) USING BTREE
)
COLLATE='latin1_swedish_ci'
ENGINE=InnoDB
;