Backend Profile
Mobile Aplikasi Kurir
Language
Javascript
Server Side
Node.js
Framework
Express
Database
Postgres using Sequelize as ORM
How to run the server
- Install Node.js on your computer Go to below link and choose according your OS https://nodejs.org/en/download/
- Clone this repository to your local machine
- At your terminal, go to the directory where you cloned this repo at
- And then type:
npm install
Migrate the database
- install sequelize-cli in global:
npm install sequelize-cli -g
- create postgres database with name: kurir_mobile
- make sure postgres installed and running
- change username and password in folder config > config.json file according to your postgres setup
- migrate the database
sequelize db:migrate
- the database should be updated
Resources
-
db schema: https://www.lucidchart.com/invitations/accept/b80ab736-01ec-417d-ad24-b57da927ca30
-
db relation: https://docs.google.com/document/d/1_PzesWJ1NjizSSfq3MFWycS0FJ5_YF9U92FpifEie1U/edit?usp=sharing
Start the app
- run the seeder with
sequelize db:seed:all
you'll have default user come with email:test@development.com
, password:testpassword
. - start the server by running
npm run start
- fetch the token by POST
email
andpassword
tolocalhost:3000/api/user/login
Testing
- create mysql database and name it
database_test
- run
sequelize --env test db:migrate:all
to run migration on you testing database. - run
sequelize --env test db:seed --seed seeders/20180118112739-seed-test-user.js
to seed the test user [run this just once.]. - run
npm run test
to run all the test.