- A configurable Restful shopping cart API build using Typescript, Node.js, Express.js, MongoDB, Mongoose, and Joi.
- Strictly followed SOLID design principles.
- Used clean architecture to ensure that the business logic is independent of external agents.
- Databases, frameworks, and the other technologies can easily be changed without disrupting the entire system.
- Proved the external independence of the system by adding a configuration option to switch the data storage strategy between using MongoDB and memory.
The following environment variables can be used to configure the server:
PORT
: The port on which the server runs (default3000
)DATASTORE
: The datastore to serve te data. Options aremongodb
(the default) andinmemory
MONGO_HOST
: Hostname or ip address of the mongodb host (defaultmongodb://127.0.0.1
)MONGO_PORT
: Port where the db can be accessed (default27017
)MONGO_DATABASE
: Name of the mongo database (defaultshoppingcart
)
npm run start
: Start the servernpm run build
: Build projectnpm run test
: Run tests
- Install the required software
- Change directory to the root folder of the project
- Run
npm install
- Run
npm run start