A module that shows similar listings and related news on a product page
- https://github.com/HRR47-FEC-Burke/seller-reviews
- https://github.com/HRR47-FEC-Burke/sidebar
- https://github.com/HRR47-FEC-Burke/main-photo
Example URL: http://localhost:3005/item/25
Please set up the environment variables for seamless functionality
You may set CLOUD_IMG_URL to serve from a local directory during development
-
Node.js v12.18.1
-
MongoDB v4.2.8
-
- To retrieve images:
CLOUD_IMG_URL=<your-cloud-static-url>
- Optional:
MONGODB_URL=<your-mongo-db-url>
PORT=<your-server-port>
URL=<your-origin-url>
- To retrieve images:
All commands from within the repository's root directory.
npm install
Seed database with 101 listings:
npm run seed
Seed with a custom amount:
npm run seed amount=<custom-amount>
On two separate terminal windows:
npm run build:watch
npm run start:watch
npm test
If npm installation is made in production mode or the dev dependencies are pruned, environment variables need to be set in the shell since dotenv is a dev dependency.
npm run build
npm start
When you start the server with $
npm run start:dev
instead, the service is designed to serve up to 100 images from your cloud. When the item id 101 is requested, it serves the address of image id 1.
Requires the dev dependencies to be installed
-
Create the grunt-aws.json file at $HOME/.aws directory
{ "accessKeyId": "<your-access-keyId>", "secretAccessKey": "<your-access-secret>", "bucket": "<your-bucket-name>", "path": "<optional-path>/" || "" }
-
Add
CLOUD_BUNDLE_URL=<your-bucket-url[-path]>
to the environment variables -
Run
grunt upload
on the terminal
-
Create the .env.docker file to set up container environment
CLOUD_IMG_URL=<your-cloud-static-url> CLOUD_BUNDLE_URL=[your-cloud-js-bundle-url] MONGODB_URL=mongodb://reburke:sln@mongo:27017/reburke-sln?authSource=admin PORT=3005 URL=<your-origin-url>
-
Run $
docker-compose up -d
to start running the service on port 80
docker-compose.yml file uses the npm start:dev command. The service is designed to serve up to 100 images from your cloud. When the item id 101 is viewed, it serves the image id 1. To change this behavior, change the
npm run start:dev
tonpm run start
before using docker-compose up.
docker-compose.yml file seeds the database with 100 items when the container starts. To change this behavior, you can remove the
npm run seed
command or change it tonpm run seed amount=<seeding-amount>
.
Dockerfile is included for the build but it will require you to setup your environment variables, volumes and network in the shell. It will not work out-of-the-box since the service is a multi-container module. Use Docker Compose instead if Docker Run if you are not sure how to set these up.