Shipmate is an interstate delivery platform,this platform allows people to send items to other geographical states through individuals traveling to those destinations.
An Express based RESTful API design was used to access a Postgres database for data storage and retrieval. Using JWT tokens to provide stateless authenticated access for retreiving and storing data in persistent storage.
This API provides the following Endpoints check the documentation here:
This project is Bootstrapped with with the following stack:
- Node (Javacript runtime).
- Express (For creating endpoints, routing, and serving files).
- TypeScript (A super set of Javacript).
- Jest (for testing).
- jsonwebtoken (JWT) (for stateless interaction).
- PostgreSQL (for creating database).
- Objectionjs(an SQL-friendly ORM )
- Knexjs(for creating migrations)
All of the dependencies required are listed in the package.json file. Use npm install
on the command line. Environment variables are defined in a example.env file.
However, you will need to install node and postgreSQL globally on your local machine
The following steps outline will set you up on how to install the app on your local machine.
- Clone this repository
git clone https://github.com/salimkarbm/shipmate.git
- From the terminal, change directory to shipmate folder
cd shipmate
-
Run
npm install
This will install the necessary packages and dependencies based on the supplied package.json. -
Then run the app with the command
npm run start:dev
-
Once these are set, start an instance of Postgres ensure Postgres is started on port 5432.
In order to use the API locally you must pre-configure the initial database. To do so access the psql prompt as postgres on the installed Postgres database and enter the following commands at the prompt:
CREATE DATABASE shipmate;
CREATE DATABASE testdb_shipmate;
To run the jest test use the following commands:
npm run testdb
this will run migration for test database.
To run models and endpoints test run the following command
npm run test
run the following command to drop the test database
npm run drop-testdb
The endpoints available for interacting with the API can be found in the Documentation here
Contributions are currently not allowed ❌ but please feel free to submit issues and feature requests ✅
Github:@salimkarbm
LinkedIn:Salim Imuzai
Twitter:@salimkarbm
- Give a ⭐ if you like this project