- Install packages:
npm install
- Start MySQL server
- Import database:
mysql -u <user_name> -p <stylish_db_name> < stylish_backend.sql
mysql -u <user_name> -p <stylish_test_db_name> < stylish_test.sql
(Optional)
- Create config:
.env
for back-end (You can copy the schema from template:.env-template
)- set
DB_HOST
,DB_USERNAME
,DB_PASSWORD
,DB_DATABASE
for MySQL server (DB_DATABASE_TEST
is Optional) - set
NODE_ENV
todevelopment
for development - set
TAPPAY_PARTNER_KEY
for cash flow (copy from your STYLiSH project) - set
TOKEN_SECRET
for jwt - set
BCRYPT_SALT
for password encryption (Optional)
- set
- Modify API_HOST destination in front-end:
- cd
public
- modify file
src/util/Api.js
- change
this.API_HOST
value tohttp://localhost:3000/api/1.0
- change
- under
public
folder- npm install
- npm run build (The five js files under
public/dist
will be modified)
- cd
- Start a redis server in
localhost
at port6379
(Optional, the server can still work without redis server, seemarketing_controller.js
for more detail) - Start server:
nodemon app.js
- Clear Browser localStorage if needed. The same address will use the same space to records localStorage key-value pairs and it may conflict with mine. (Optional)
- Import
stylish_test.sql
into database - Set
DATABASE_TEST
key tostylish_test
- Run integration test:
npm run test
- Run integration test:
npm run test_windows