Backend API application to manage motorcycle drivers, passengers and monitor the current ongoing rides.
- Node (v14.15.0 at the time of development)
- PostgreSQL (10.15 at the time of development)
- Frameworks; Express (Web framework), KenxJs (DB ORM), Jsonwebtoken (Token generation library)
Using the link provided on the email, copy repo url then clone using the command git clone git@github.com:cyrilokidi/safeboda-node-express.git
Create a file named .env
at the application root folder and add environment variables as shown in the example below.
# either; development, test or production
# use test when running test to disable printing logs on termminal
NODE_ENV=development
PORT=2000
ROOT_PATH=./
# Database (postgres) config. variables
DB_HOST=127.0.0.1
DB_PORT=5432
DB_USER=postgres
DB_PASSWORD=password
DB_NAME=safeboda
# JWT secret key
JWT_SECRET_KEY=ThisIsSecret
# Default admin
ADMIN_EMAIL=okidicyril@gmail.com
ADMIN_PASSWORD=password
Run
npm install
, thennpm run migrate
before running any other commands.
npm install
to install all dependencies required.npm run migrate
to run all migration files.npm run rollback
to rollback all migrations.npm run start
to start the application.npm run dev
to run the application in development mode. Prints log events on the terminal.npm run test
to execute all test files in thetests
folder.
A typical client request goes through the process listed below.
Step | Description |
---|---|
app | Main entry point into the application. |
routes | Exposes all application routes (end-points). |
controllers | Controls the order of processing a request. |
services | Accepts client request, then returns appropriate response. |
Authentication end-points.
Only requests handled by end-points in this section do not need authorization.
Driver management.
Passenger management.
Ride management.