Skip to content
This repository has been archived by the owner on Jul 2, 2020. It is now read-only.

NinjasCL-archive/walmart-challenge

Repository files navigation

Walmart Challenge

This is a project made for Walmart Chile's challenge. Implemented by Camilo Castro <[email protected]>.

30 June 2020.

86102022 07100e00 ba89 11ea 8925 0efe8fcd6a52

You can watch the Example Video that showcase the main functionality.

About

The project must have:

  • Product Search API (using provided products mongo collection).

  • Palindrome Special Discount.

  • Website with Search and Product Display.

Also:

  • Docker files.

  • Good docs.

  • Good code.

  • Good tests.

Technologies

This project was made using the following technologies:

Installation

First you would need Docker and Make already installed.

Arquitecture

  • Docker is the main environment where the servers runs.

  • There is a MongoDB server that is the initial service.

  • The backend depends on the MongoDB. Uses the port 3333.

  • The frontend is built and served using NGINX. Uses the port 8080.

Configure .env file

The .env file inside backend/ is ready to be used.

Just in case. The following is the recommended configuration for development environments.

HOST=0.0.0.0 # 0.0.0.0 is needed for accessing from outside the container
PORT=3333
NODE_ENV=development
APP_NAME=Walmart Challenge
APP_URL=http://${HOST}:${PORT}
CACHE_VIEWS=false
APP_KEY=cusYyCYCPpUf2HdOgqSlkyjqJcHeQ2eK
DB_CONNECTION=mongodb
DB_HOST=database # defined in docker-compose.yml in links section
DB_PORT=27017
DB_USER=productListUser
DB_PASSWORD=productListPassword
DB_AUTH_SOURCE=admin
DB_DATABASE=promotions
DB_DEBUG=true
HASH_DRIVER=bcrypt

$ make install

The command make install will execute docker-compose up -d --build and provision the database. Wait a few moments and you will be able to navigate localhost.

$ make build

The command make build will execute docker-compose up -d --build.

$ make test-backend

The command make test-backend will execute the backend test suite.

$ make test-frontend

The command make test-frontend will execute the frontend test suite.

$ make test

The command make test will execute the backend and frontend test suite.

Usage

This app can be used as a Website or as an API.

Website

The website would be available at:

REST API

The following query will return the results for the palindrome sadfdas. The rate has been limited to 1000 requests per minute.

Pagination is possible using the page query param.

The documentation is available at

Database

Can be accessed using the following connection string:

  • mongodb://productListUser:productListPassword@localhost:27017/promotions?authSource=admin

Made with by Ninjas.cl.