pillar-combined-backend-server
v1.0.8
Published
Registration backend for the Pillar Wallet
Downloads
10
Readme
Installation
- run
npm install -g yarn sequelize-cli
- run
yarn install
- copy
/.sample.env
file to/.env
with your local development settings
Running the project
To run the project in dev mode use yarn start-dev
For the production mode use yarn start
Development
To enable dev mode - add NODE_ENV=development
to .env
file
Good article to understand sequelize: https://scotch.io/tutorials/getting-started-with-node-express-and-postgres-using-sequelize
Migrations
- to create new model run
sequelize model:create --name todoItem --attributes content:string,complete:boolean
- to create empty migration run
sequelize migration:create --name create-user
- to run migrations and sync db use
sequelize db:migrate
Seeding
To populate sample data into db use: sequelize db:seed:all
Unit tests
$ npm test
Test reports
$ npm run test:Coverage
$ open ./reports/jest/test-report.html
$ open ./reports/lcov-report/index.html
Static Analysis
$ npm run plato
$ open ./reports/plato/index.html
Local dev setup
easiest way - install xampp. this gives one click install of mysql and phpmyadmin. https://www.apachefriends.org/download.html download latest stable ( non VM )package for your operating system and install it. Ignore any extras like bitnami!
run Xampp from applications. this opens Xampp control pannel, hit start. goto services tab, start mysql and apache.
Browse to http://localhost:80 you should get the xampp home page, with a link to phpmyadmin. If not, restart computer, relaunch Xampp
run xampp management console, start mysql and apache. goto localhost (default port - 80) - should open the console with a link to php.
edit your .env file:
To connect phpmyadmin to a remote mysql instance (useful for getting sql dumps etc) - find config.inc.php
DB_HOST=localhost
DB_USER=root
DB_PASS=
DB_NAME=pillar
NODE_ENV=development
Connect local core-wallet to local core-wallet-backend Note - pending merge of search-bar branch... in providers/api/api.ts // const REGISTRATION_URL_ROOT = "http://127.0.0.1:8080/"; const REGISTRATION_URL_ROOT = 'https://pillar-registration.herokuapp.com/' Manually uncomment line pointing to 127... and comment out one pointing to heroku.
TODO: make front and backend configurable by env.
To connect phpmyadmin to a remote mysql instance (useful for getting sql dumps etc) - find config.inc.php
for Mac, you may need sudo to edit it as under /Applications, e.g. sudo nano /Applications/XAMPP/xamppfiles/phpmyadmin/config.inc.php
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = '[FILL]';
$cfg['Servers'][$i]['password'] = '[FILL]';
/* Server parameters */
//$cfg['Servers'][$i]['host'] = 'node.pillarproject.io';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = true;
Tip for testing new routes locally - turn off message signing by not using { checkSignature } middleware in route makes it simpler.